PHP 4.0 Bug #8120 Updated: mysql_list_fields() returns no result

From: Date: Fri, 12 Jan 2001 15:42:46 +0000
Subject: PHP 4.0 Bug #8120 Updated: mysql_list_fields() returns no result
Groups: php.dev 
Request: Send a blank email to php-dev+get-43872@lists.php.net to get a copy of this message
ID: 8120 Updated by: cynic Reported By: davidg@kmcoinc.com Old-Status: Open Status: Closed Bug Type: MySQL related Assigned To: Comments: It might be mysql_field_name() would actually work if you had correct number of arguments in the mysql_connect() call. Seems like your error_reporting is too low, or display_errors is off, otherwise you'd know it. it works for me with mod_php4 built from today's CVS, MySQL 3.23.27, and Apache 1.3.15-dev: $link = mysql_connect( 'localhost' , 'root', 'xxx' ); $result = mysql_list_fields( 'mysql' , 'host' , $link); print "Result is: $result\n\n"; $num = mysql_num_fields($result); for($i=0;$i<$num;$i++) { $name = mysql_field_name($result,$i); $type = mysql_field_type($result,$i); echo "$name: $type\n"; } output: Result is: Resource id #2 Host: string Db: string Select_priv: string Insert_priv: string Update_priv: string Delete_priv: string Create_priv: string Drop_priv: string Grant_priv: string References_priv: string Index_priv: string Alter_priv: string If you still encounter this error with newer versions of PHP and/or MySQL, reopen this bug report, please. Previous Comments: --------------------------------------------------------------------------- [2000-12-05 11:14:02] davidg@kmcoinc.com I tried using the code snippet in bug #5750 but couldn't get any results: $link = mysql_connect($dbserver,$database, 'root', 'mypwd'); $result = mysql_list_fields($database,"meta", $link); print "nResult is :".$result; $num = mysql_num_fields($result); for($i=0;$i<$num;$i++) { $name = mysql_field_name($result,$i); $type = mysql_field_type($result,$i); echo "$name $typen"; $result is always undefined. I'm using Windows2000, MySQL 3.23.24-beta, and Apache. I know the database exists and the table "meta" exists because they are used in many other pages for DHTML generation. Thanks Dave --------------------------------------------------------------------------- Full Bug description available at: http://bugs.php.net/?id=8120

« previous php.dev (#43872) next »