I am trying have the following code access a MySQL database created in phpMyAdmin. It keeps getting stuck on the second paragraph where it says
“There are currently no stores in our database”
The proper table is implemented in the code. I am lost. Any help would be much appreciated. Thanks
[QUOTE]
<?
$username=”albanygr”;
$password=”password”;
$database=”albanygr_DBTest”;
mysql_connect(localhost,$username,$password);
@mysql_select_db($database) or die( “Unable to select database”);
$query=”SELECT * FROM timetest”;
$result=mysql_query($query);
$num=mysql_numrows($result) or die(‘There are currently no stores in our database.’);
echo ‘<table border=”0″ cellspacing=”2″ cellpadding=”2″>
<tr>
<th><font face=”Arial, Helvetica, sans-serif”>Store Name</font></th>
<th><font face=”Arial, Helvetica, sans-serif”>Hours of Operation</font></th>’;
$i=0;
while ($i < $num) {
$name=mysql_result($result,$i,”store_name”);
$open=mysql_result($result,$i,”open_time”);
$close=mysql_result($result,$i,”close_time”);
echo ‘<tr>
<td><font face=”Arial, Helvetica, sans-serif”>’.$name.'</font></td>
<td><font face=”Arial, Helvetica, sans-serif”>’.$open.’ – ‘.$close.'</font></td></tr>’;
$i++;
}
echo ‘</table>’;
mysql_close();
?>