Jump to content

mysql_fetch_row() Error


ArizonaJohn

Recommended Posts

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

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());

 

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

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

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.