ArizonaJohn Posted June 15, 2009 Share Posted June 15, 2009 Hello, When I run the query below, I get this error for the line "list($isThere) = mysql_fetch_row($resA);": Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource Any ideas why? Thanks in advance, John <?php $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); list($isThere) = mysql_fetch_row($resA); if ($isThere) { $table_list[] = $table; } } ?> Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/ Share on other sites More sharing options...
joel24 Posted June 15, 2009 Share Posted June 15, 2009 check to see if that sql statement is executing properly? change the $reA = mysql_query... line to the following... you'll want to change it back when you make the site live and put in some custom error handling $resA = mysql_query($sqlA) or die(mysql.error()); Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856590 Share on other sites More sharing options...
ArizonaJohn Posted June 15, 2009 Author Share Posted June 15, 2009 joel24, When I follow your suggestion, I get the following error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856602 Share on other sites More sharing options...
MadTechie Posted June 15, 2009 Share Posted June 15, 2009 change $resA = mysql_query($sqlA) or die(mysql.error()); to $resA = mysql_query($sqlA) or die("$sqlA:".mysql.error()); But it sounds like $entry isn't being set Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856608 Share on other sites More sharing options...
ArizonaJohn Posted June 15, 2009 Author Share Posted June 15, 2009 MadTechie, When I follow your suggestion, I get the following error: "Fatal error: Call to undefined function error()" for the line that has "$resA = mysql_query($sqlA) or die("$sqlA:".mysql.error());" Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856613 Share on other sites More sharing options...
MadTechie Posted June 15, 2009 Share Posted June 15, 2009 Oh my bad.. mysql.error should be mysql_error Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856620 Share on other sites More sharing options...
ArizonaJohn Posted June 15, 2009 Author Share Posted June 15, 2009 OK, MadTechnie, Now, when I enter in miami.com for $entry, I get the following error message: SELECT COUNT(*) FROM #&*+ WHERE `site` LIKE 'miami.com':You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1 Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856663 Share on other sites More sharing options...
garethhall Posted June 15, 2009 Share Posted June 15, 2009 Are you select your DB? I am not seeing the select part in you code. <?php mysql_select_db(database,connection) ?> Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856666 Share on other sites More sharing options...
MadTechie Posted June 15, 2009 Share Posted June 15, 2009 Ahhh i assume you entered #&*+ while(list($entry)= mysql_fetch_row($result)) //Update this line $table to $entry Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856668 Share on other sites More sharing options...
ArizonaJohn Posted June 16, 2009 Author Share Posted June 16, 2009 MadTechnie, When I follow your instructions, I get the following error: SELECT COUNT(*) FROM WHERE `site` LIKE '#&*+':You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'WHERE `site` LIKE '#&*+'' at line 1 Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856774 Share on other sites More sharing options...
MadTechie Posted June 16, 2009 Share Posted June 16, 2009 $table isn't being set.. what table are you searching ? Link to comment https://forums.phpfreaks.com/topic/162292-mysql_fetch_row-error/#findComment-856955 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.