MySQL Forums
Forum List  »  PHP

Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Posted by: Barry Galbraith
Date: April 10, 2011 01:35AM

Seperate the building of the query string from the execution so you can echo the query to see EXACTLY what you are sending.

Also, you should always test the result of a query to catch any errors.

$term = $_POST['term'];

$query = "select * from work where tags like '%$term%'";

echo $query;

$sql = mysql_query($query) or die(mysql_error());


while ($row = mysql_fetch_array($sql)){

...

Good luck,
Barry.

Options: ReplyQuote


Subject
Written By
Posted
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
April 10, 2011 01:35AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.