note 18318 deleted from function.mysql-list-fields by tularis

From: Date: Sat, 19 Feb 2005 18:09:49 +0000
Subject: note 18318 deleted from function.mysql-list-fields by tularis
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-85255@lists.php.net to get a copy of this message
Note Submitter: joe1977 at tlen dot pl ---- I'm not sure, but I guess PHP doesn't give any function to return id_number of field_name inside certain table. This could be usefull if you want to have field_id. function mysql_get_field_id($table, $name) { $link = mysql_connect('localhost', 'root', ''); $fields = mysql_list_fields("mydatabse", $table, $link); $columns = mysql_num_fields($fields); for ($i = 0; $i < $columns; $i++) { if(mysql_field_name($fields, $i) == $name) echo $i; } } Regards, Danny.

« previous php.notes (#85255) next »