Re: [PHP] Strange error on mysql_fetch_array

2001-06-28 Thread Richard Lynch

 How can the resource be invalid if I'm getting the results back? I'd
 appreciate any explaination.

What results are you getting?...

 $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);

I don't think DESC $table_name $field_name is valid SQL, is it?...

DESC is DESCENDING in an ORDER BY clause...

Perhaps if you used DESCRIBE?...  Is that what you are doing?...

There are built-in functions for getting the table definitions and so forth.
They may work better...

 $row = mysql_fetch_array($result_id); # This is line 9

--
WARNING [EMAIL PROTECTED] address is an endangered species -- Use
[EMAIL PROTECTED]
Wanna help me out?  Like Music?  Buy a CD: http://l-i-e.com/artists.htm
Volunteer a little time: http://chatmusic.com/volunteer.htm



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Strange error on mysql_fetch_array

2001-06-27 Thread CC Zona

In article 046401c0fee3$a6c789e0$6401a8c0@Lynchux100,
 [EMAIL PROTECTED] (Richard Lynch) wrote:

  $result_id = @mysql_query(DESC $table_name $field_name);
 
 I don't think DESC $table_name $field_name is valid SQL, is it?...
 
 DESC is DESCENDING in an ORDER BY clause...
 
 Perhaps if you used DESCRIBE?...  Is that what you are doing?...

DESC {table name} [{field name}] is a valid expression in MySQL.  It's a 
synonym for the DESCRIBE keyword.  Though the query could still be failing 
for any number of reasons (invalid table name, invalid field name, older 
version of MySQL that doesn't support that syntax, etc.).

Throw in die(), mysql_error(), $php_errormsg; turn down error_reporting, 
and/or turn off display_errors...anything but using the @ sign by itself (a 
surefire way to never clue in to much stuff is silently going wrong).

-- 
CC

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Strange error on mysql_fetch_array

2001-06-27 Thread elias

dunno
but my it's just failing at the mysql_connect()
shouldn't you specify the password too?

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 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: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Strange error on mysql_fetch_array

2001-06-27 Thread David Robley

On Wed, 27 Jun 2001 06:31, [EMAIL PROTECTED] 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...

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Strange error on mysql_fetch_array

2001-06-27 Thread Ronny Mandal

- Original Message -
From: David Robley [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; PHP General [EMAIL PROTECTED]
Sent: Wednesday, June 27, 2001 8:47 AM
Subject: Re: [PHP] Strange error on mysql_fetch_array


 On Wed, 27 Jun 2001 06:31, [EMAIL PROTECTED] 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...

 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]
 To contact the list administrators, e-mail: [EMAIL PROTECTED]


Hmm, maybe the prefix '@' suppresses the returning link-identifier. Just a
suggestion!

--

RM


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




RE: [PHP] Strange error on mysql_fetch_array

2001-06-27 Thread Chadwick, Russell


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: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]