RE: [PHP] Strange error on mysql_fetch_array

From: Date: Wed, 27 Jun 2001 15:00:34 +0000
Subject: RE: [PHP] Strange error on mysql_fetch_array
Groups: php.general 
Request: Send a blank email to php-general+get-55399@lists.php.net to get a copy of this message
From experience with oracle, desc only works in an sql prompt, not through code. So use the more lengthy method in mysql: SHOW FIELDS FROM $table_name in oracle: SELECT c.column_name, c.data_type, c.data_length, c.data_precision, c.data_scale, c.nullable FROM sys.dba_tab_columns c WHERE c.owner = '$owner' AND c.table_name = '$table_name' --- Toolshed Computer Productions - Professional PHP Hosting Hosting - Dedicated Servers - Design - Programming http://www.toolshed51.com -----Original Message----- From: tjacobs-php@codegnome.org [mailto:tjacobs-php@codegnome.org] Sent: Tuesday, June 26, 2001 2:01 PM To: PHP General Subject: [PHP] Strange error on mysql_fetch_array 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 -- Todd A. Jacobs CodeGnome Consulting, LTD -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net For additional commands, e-mail: php-general-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.general (#55399) next »