これを見てください:
<?php
$connection = mysql_connect("localhost","root_user","root_password")
or die("problems connecting to DB.");
mysql_select_db("my_database",$connection)
or die("Problems selecting DB.");
$records = mysql_query("select id, name, school from students",$connection)
or die("Problems on querying " . mysql_error() );
while ($record = mysql_fetch_array($records)) {
echo "id: " . $record['id'] . "<br>";
echo "name: " . $record['nombre'] . "<br>";
echo "school: " . $record['school'] . "<br>";
}
mysq_close($connection);
?>