List:General Discussion« Previous MessageNext Message »
From:Jerry Schwartz Date:September 21 2011 2:18pm
Subject:RE: asking question
View as plain text  
It is important to call all of the MySQL functions in the right order. It is 
very easy to skip one if you are just learning. I'm not going to give you the 
exact function calls, because there are several sets. Pick a set (PDO works 
with different databases, so it is most portable) and then keep these steps in 

1. Connect to the database server; this returns a resource (handle) for the 
database server
2. Select the database, if the first step didn't already do that
3. Execute a query, using the resource from step 1; this will return a value 
that you will use in the next step
4a. If the query returned a set of records (a valid SELECT, for example), you 
can now use the functions (such as mysql_fetch_array) that fetch the data for 
a row
4b. If the query did NOT return a set of records, the query would have 
returned a Boolean value to tell you if it worked or not
5. Free up the result set

That's the general sequence. The details will be different for mysql, mysqli, 
and PDO.

Your error message means that either you skipped step 1, 2, or 3; or that step 
3 didn't return a record set. If could have been something like an INSERT, or 
it could have been a SELECT that wasn't valid.

Prepared statements use a more complicated sequence.

I hope that helps.


Jerry Schwartz
Global Information Incorporated
195 Farmington Ave.
Farmington, CT 06032

860.674.8796 / FAX: 860.674.8341
E-mail: jerry@stripped
Web site:

>-----Original Message-----
>From: valery-christian [mailto:valechris2001@stripped]
>Sent: Wednesday, September 21, 2011 8:17 AM
>To: mysql@stripped
>Subject: asking question
>the meaning of Warning: mysql_fetch_array(): supplied argument is not a valid
>MySQL result resource in C:\Program Files\EasyPHP 2.0b1\www\memo3\index.php 
>line 64

asking questionvalery-christian21 Sep
  • Re: asking questionReindl Harald21 Sep
  • RE: asking questionJerry Schwartz21 Sep
  • RE: asking questionJerry Schwartz21 Sep