ArizonaJohn Posted June 18, 2009 Share Posted June 18, 2009 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 More sharing options...
Ken2k7 Posted June 18, 2009 Share Posted June 18, 2009 Why are you using mysql_num_fields? Link to comment https://forums.phpfreaks.com/topic/162710-if-statement-not-working/#findComment-858674 Share on other sites More sharing options...
ArizonaJohn Posted June 18, 2009 Author Share Posted June 18, 2009 Why are you using mysql_num_fields()? Before I tried it, I tried mysql_num_rows(), and that didn't work, so I thought maybe mysql_num_fields() was what I needed. Link to comment https://forums.phpfreaks.com/topic/162710-if-statement-not-working/#findComment-858678 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.