Greetings,
I have a piece of code that I have been using which dumps all the fields of a specified table into a csv file. See code:
$link = mysql_connect('localhost', 'user', 'pass');
$fields = mysql_list_fields("db", "table", $link);
$columns = mysql_num_fields($fields);
$csv = fopen("/path/to/file.csv", "w");
for ($i = 0; $i < $columns; $i++) {
$fieldnames = mysql_field_name($fields, $i);
fwrite($csv,"$fieldnames,");
}
fclose($csv);
What I am needing now, is specific field names, not all of them. Is there a way to force the list fields function to only list specific fields?
Any help is greatly appreciated.
I have a piece of code that I have been using which dumps all the fields of a specified table into a csv file. See code:
$link = mysql_connect('localhost', 'user', 'pass');
$fields = mysql_list_fields("db", "table", $link);
$columns = mysql_num_fields($fields);
$csv = fopen("/path/to/file.csv", "w");
for ($i = 0; $i < $columns; $i++) {
$fieldnames = mysql_field_name($fields, $i);
fwrite($csv,"$fieldnames,");
}
fclose($csv);
What I am needing now, is specific field names, not all of them. Is there a way to force the list fields function to only list specific fields?
Any help is greatly appreciated.