I have a table used for checkboxes where values are either 1 or 0.
I'm having an issue printing column names for the selected row where the field value is equal to 1 (excluding any row equal to 0) and separate by comma, using implode.
I've tried several approaches but without the use of mysql_num_fields I haven't been able to print the field names with the array (mysql_fetch_array)
Here is what I am currently working with. Any help is much appreciated. And yes, I will be moving to mysqli.
$query_columns = mysql_query("SELECT field1, field2, fields3 FROM table1 WHERE user_id = '" . $id . "'");
$numberfields = mysql_num_fields($query_columns);
for ($i=0; $i<$numberfields ; $i++ ) {
$var = mysql_field_name($query_columns, $i);
$row_title .= $var;
}
echo $row_title;