"; // printing table headers for($i=0; $i<$fields_num; $i++){ $field = mysql_fetch_field($result); echo "{$field->name}"; } while($row = mysql_fetch_assoc($result)){ echo ""; // $row is array... foreach( .. ) puts every element // of $row to $cell variable foreach($row as $cell) echo "$cell"; echo "\n"; } echo ""; } ?>