Hi, I am a complete newbie to PHP coding:
I cannot retrieve information from the created table and keep getting No database selected:
<?php
echo "Hello World!";
?>
<?php $con = mysql_connect("localhost","ryandb","");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("my_db", $con);
$result = mysql_query("SELECT * FROM customer") or die(mysql_error());
echo "<table border='1'>
<tr>
<th>firstname</th>
<th>surname</th>
<th>dob</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['firstname'] . "</td>";
echo "<td>" . $row['surname'] . "</td>";
echo "<td>" . $row['dob'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>
Any help would be greatly appreciated !
Cheers

