Jump to content

having trouble with this "simple" code


pioneerx01

Recommended Posts

$query  = "SELECT * FROM name_list WHERE Name= '$_POST[Name]' ";
$result = mysql_query($query);
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
if ( ($row['Name']) == $_POST['Name'] ) 
      echo "ERROR";
  else echo "rest of the code";
  }

 

So this code compares (or it should) the name entered by the user in the form to the list of names already in database. If the user enters a name in the form that is in the database I get and "ERROR" as I should. But is they enter a name that is not in the database I am not getting "rest of the code."

 

Why?

Link to comment
https://forums.phpfreaks.com/topic/222333-having-trouble-with-this-simple-code/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.