Determining if a MySQL field exists
| From: | David Duong | Date: | Sat, 14 Sep 2002 00:15:02 +0000 |
| Subject: | Determining if a MySQL field exists | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-116333@lists.php.net to get a copy of this message | ||
Is their a 1 function (MySQL or PHP) method of determining if a MySQL field
exists by returning true or false?
MySQL_Field_exists ($table, $fieldname);
for some reason this is not working:
$link = mysql_connectnselect(); # A working custom function.
$result = mysql_list_fields($mysql[2], $mysql[5], $link);
$columns = mysql_num_fields($result);
for ($i = 0; $i < $columns; $i++) {
$fields[] = mysql_field_name($result, $i);
}
if ($mysql[0] == 1 && array_key_exists($key, $fields)) ...