Displaying the books table using PHP
', "\n";
// Display the column names
echo "\n";
for ($i = 0; $i < $num_columns; $i++)
{
echo "", mysql_field_name($fields, $i), " | \n";
}
echo "
\n";
// Loop over the rows of the table.
// $row contains the the information for each row
while ($row = mysql_fetch_assoc($result))
{
// Now loop through the entries in each row
echo "\n";
foreach ($row as $col_value)
{
echo "$col_value | \n";
}
echo "
\n";
}
echo "\n";
// Free the resources and close the connection
mysql_free_result($result);
mysql_close($db_link);
?>