I figured out hot to get contected to my database in line one I dont get a connection error anymore. But not Im getting an error that says no database selected. What could the issues be? Is my code correct?
First time reading from a mysql database in php. Thanks for the help.
<?php
if (!($con = mysql_connect('host', 'user', 'pw'))) {
die('Connect failed: ' . mysql_error());
}
mysql_select_db("my_db", $con) or die('Error select: '.mysql_error());
$result = mysql_query ('SELECT * FROM Gallerys') or die ('Error query: '.mysql_error ());
echo "<table border='1'>
<tr>
<th>Thumb Url </th>
<th>Gallery Url</th>
</tr>";
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['THUMBURL'] . "</td>";
echo "<td>" . $row['GALLERYURL'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysql_close($con);
?>