Re: MySQL error
| From: | Joao Prado Maia | Date: | Tue, 10 Oct 2000 01:11:56 +0000 |
| Subject: | Re: MySQL error | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-19283@lists.php.net to get a copy of this message | ||
On Mon, 9 Oct 2000, Brian Rue wrote:
> I'm getting the following error:
> Warning: Supplied argument is not a valid MySQL result resource .....
>
> Here's the code:
> $query="SELECT * FROM games WHERE
> genre=$gameone_genre&number=$gameone_number";
> $info=mysql_query($query,$db);
> $row=mysql_fetch_row($info);
>
> The last line is the one causing the error. What am I doing wrong?
Hi Brian,
That means that your result set is empty, so you are actually trying to
fetch a "row" that does not exist. You have an error on your SQL query,
since as far as I know, you should write
$sql = "SELECT * FROM games WHERE genre=$gameone_genre AND
number=$gameone_number";
Also, if the column named "genre" is a CHAR or VARCHAR, you should quote
the query like this
$sql = "SELECT * FROM games WHERE genre='$gameone_genre' AND
number=$gameone_number";
Regards,
Joao
--
Joao Prado Maia
Web Developer
Kefta, Inc.
T: (415) 391-6881 ext 8008
F: (415) 391-7079