$c "root", "password");
$result=mysql_db_query("Database", "SELECT * FROM `info`", $conn);
// Get query results
$row= mysql_fetch_row($result);
echo '';
echo '';
/ / Display field name
echo "< td bgcolor="#000F00">'. ";
mysql_field_name($result, $i);
echo "";
}
echo "
// Locate the first record
mysql_data_seek($result, 0);
// Loop through the records
while ($row=mysql_fetch_row($result))
{ & Echo "& LT; TR & GT; & LT;/B & GT;";
for ($ i = 0; $ i & lt; mysql_num_fields ($ result); $ i ++) {
echo '& lt; td bgcolor = " #00ff00 "& gt; ' ; lt ;/b>";
echo "";
// Release resources
mysql_free_result($result);
// Close connection
mysql_close($conn);
?>
echo came out Mainly tables
The above introduces the PHP connection to mysql database demo, including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.