How to get a list of a tables field / column names from MySQL using PHP – getFieldNames() Function
May 13th, 2008 by Oliver - Tagged with MySQL, PHP - Posted in Web Development
A simple function to replicate the funcationality of the depreciated mysql_list_fields() function. It returns a simple array with a numeric index of the column / field names.
$database – String – The database you want to use
$connect_string – String – Your connection string
$table – String – The name of the table you wish to list the fields from
-
function getFieldNames($database,$connect_string,$table){
-
-
$query_getfields = “SHOW COLUMNS FROM “.$table;
-
-
do {
-
-
return $fields;
-
-
}







