ID: 8120
Updated by: cynic
Reported By: [EMAIL PROTECTED]
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] [EMAIL PROTECTED]
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


-- 
PHP Development 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]

Reply via email to