Re: Strange error on mysql_fetch_array
| From: | David Robley | Date: | Wed, 27 Jun 2001 06:47:04 +0000 |
| Subject: | Re: Strange error on mysql_fetch_array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-55314@lists.php.net to get a copy of this message | ||
On Wed, 27 Jun 2001 06:31, tjacobs-php@codegnome.org wrote:
> The following code fragment works properly, in that I get the output
> I'm expecting. However, if I don't disable error messages with @, I get
> an error message from PHP saying: "Warning: Supplied argument is not a
> valid MySQL result resource in /var/www/htdocs/cgcm/test2.php on line
> 9."
>
> How can the resource be invalid if I'm getting the results back? I'd
> appreciate any explaination.
>
> $connection_id = @mysql_connect ('localhost', 'root') or die('No
> connection.');
> $database_id = @mysql_select_db ('cgcms', $connection_id) or
> die('No connection.');
>
> ...
>
> $result_id = @mysql_query("DESC $table_name $field_name");
> $row = mysql_fetch_array($result_id); # This is line 9
Try using mysql_error() to see if there is some feedback from mysql. Put
it just after your mysql_query().
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
Common sense isn't...