Home » » mysql_field_name

mysql_field_name

Written By 1 on Sunday, September 30, 2012 | 7:26 PM

string mysql_field_name ( resource $result , int $field_offset )

Get the name of the specified field in a result

mysql_field_name() returns the name of the specified field index.


<?php
/* The users table consists of three fields:
 *   user_id
 *   username
 *   password.
 */
$link mysql_connect('localhost''mysql_user''mysql_password');
if (!
$link) {
    die(
'Could not connect to MySQL server: ' 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($res0) . "\n";
echo 
mysql_field_name($res2);
?>


Eliminacion de registros Mysql, PHP

0 Comment:

Post a Comment