ID:          30055
 Updated by:  [EMAIL PROTECTED]
 Reported By: slick dot user at gmail dot com
-Status:      Open
+Status:      Closed
-Bug Type:    Website problem
+Bug Type:    Documentation problem
 PHP Version: Irrelevant
 New Comment:

This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time to
get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make the PHP documentation
better.


Previous Comments:
------------------------------------------------------------------------

[2004-09-10 18:48:17] slick dot user at gmail dot com

Description:
------------
in the manual under mysql_field_name(),
http://us2.php.net/manual/en/function.mysql-field-name.php.
Example 1 is incorrect, the if statement after mysql_connect will
always run true and the die statement will always run.

Nick 


Reproduce code:
---------------
<?php
/* The users table consists of three fields:
 *  user_id
 *  username
 *  password.
 */
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');
if (!$db_selected) {
   die('Could not set $dbname: ' . mysql_error());
}
$dbname = 'mydb';
$db_selected = mysql_select_db($dbname, $link);
if (!$db_selected) {
   die('Could not set $dbname: ' . mysql_error());
}
$res = mysql_query('select * from users', $link);

echo mysql_field_name($res, 0) . "\n";
echo mysql_field_name($res, 2);
?> 

Expected result:
----------------
The above code would produce:

Could not set :

The if was probably suppose to check $link, not $db_selected



------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=30055&edit=1

Reply via email to