Use mysql_fetch_row
, then you can use $row_data[0]
etc.
while ($row_data = mysql_fetch_row($res_data)) {
$html .= '<tr>';
for($i = 0; $i < count($row_data); $i++) {
$html .='<td>'.$row_data[$i].'</td>';
}
$html .= '</tr>';
}
Please note that you should not combine this with SELECT *
as any changes to the column order would break your code.
8
solved without indicate field name in PHP using MySQL get all data [closed]