php - Match single posted data with two column is mysql -


i have login form works if user email password , 2 pic correct echo logged in problem email match password match how can match images single [select html tag]. here html form....

<select name="image" multiple="multiple">   <?php    for($i=0;$i<5;$i++)    echo"<option  data-img-src=\"$pic[$i]\" value=\"$pic[$i]\" ></option>";     ?>   </select> 

and mysql query here .......

$mysql=mysql_query("select * `table` `email`='$email' , `password`='$pass' , `image1`='$image' , `image2`='$image'") or die(mysql_error());  if(mysql_num_rows($mysql) ==1){     $_session['user']= $email;     header("location: home.php");                    } else {     echo "error";     session_destroy(); } 

if both images match logged in otherwise not

the idea each 'image' tied id in code and/or database. when person selects image they're selecting id image represents.

users, setting profile, go through similar process, selecting image (which saves image's id in user row).

when comes logging in, it's simple case of comparing id of image selected id stored in user's row.

this basic premise, , doesn't cover security aspect of feature.

i see html supports user being able select multiple images (though use/reference 2 in sql query). implementation doesn't change compared selecting single image, answer still applies.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -