Skip navigation links

MySQL Forums :: PHP :: [Resolved] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource


Advanced Search

[Resolved] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource
Posted by: Ella Durham ()
Date: April 10, 2011 01:10AM

Hello, I know this question has been addressed here and in other places on the internet, but I can't seem to find a way to fix this error. Most people say "it is a problem with your query" and that you should try testing it against the database.

Well, I checked to make sure I was spelling everything correctly, and I even "checked it against the database"... I think... if that means going to the SQL tab and typing it into the box that says "Run SQL query/queries on database" (sorry I am very inexperienced with all of this). It returned with "Your SQL query has been executed successfully ( Query took 0.0002 sec )"

Anyway, below is the code, if someone would be able to help I would greatly appreciate it!


<?php
mysql_connect ("localhost", "username","password")  or die (mysql_error());
mysql_select_db ("test");

$term = $_POST['term'];

$sql = mysql_query("select * from work where tags like '%$term%'");

while ($row = mysql_fetch_array($sql)){
	echo 'ID: '.$row['ID'];
	echo '<br/> File: '.$row['file'];
	echo '<br/> Title: '.$row['title'];
	echo '<br/> Description: '.$row['description'];
		echo '<br/> Tags: '.$row['tags'];
	echo '<br/><br/>';
	}

?>



Edited 2 time(s). Last edit at 04/10/2011 01:40PM by Ella Durham.

Options: ReplyQuote


Subject Written By Posted
[Resolved] Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Ella Durham 04/10/2011 01:10AM
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Barry Galbraith 04/10/2011 01:35AM
Re: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource Ella Durham 04/10/2011 10:16AM


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.