Jump to content

If statement not working


ArizonaJohn

Recommended Posts

Hello,

 

I want the output of the code below to be "$entry does not exist" if there is no $entry value anywhere under the "site" column in the database.  However, this is not happening when I enter in a value for $entry that I know is not under the "site" column in the database.  Is there something wrong with my database?

 

Thanks in advance,

 

John

 

$result = mysql_query("SHOW TABLES FROM feather") 
or die(mysql_error()); 


while(list($table)= mysql_fetch_row($result))
{
  $sqlA = "SELECT COUNT(*) FROM `$table` WHERE `site` LIKE '$entry'";
  
  $resA = mysql_query($sqlA) or die("$sqlA:".mysql_error());
  if(mysql_num_fields($resA)>0){
  list($isThere) = mysql_fetch_row($resA);
  if ($isThere)
  {
     $table_list[] = $table;
  }
  }
  else{
print "<p class=\"topic\">$entry does not exist</p>\n";
}
}

Link to comment
https://forums.phpfreaks.com/topic/162710-if-statement-not-working/
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.