Hello everyone,
Is there anyway to combined mysql_fetch_array and mysql_fetch_field?
I would like to get the fields name for my form from my table, as well as the data that goes with it, for the value.
$sql = "SELECT * from table";
$result = mysql_query($sql) or die(mysql_error());
while ($row = mysql_fetch_field($result)) {
echo $row->name;
while ($var = mysql_fetch_array($result)) {
echo $var['name'];
}
}
echo '<input type="text" name="' . $row->name . '" value="'.$var['name'].'">';
Any help is greatly appreciated.