<?
// open connection to database
$connection = mysql_connect($hostname, $user, $pass) or die ("Unable to connect!");
// get Pharmacy Details Information
$query2 = "SELECT l_name, f_name, app_position FROM pharmacist WHERE Ph_ID = '$Ph_ID'";
$result2 = mysql_db_query($database, $query2, $connection) or die ("Error in query: $query2. " . mysql_error());
$p_row = mysql_fetch_array( $result2 );
if ($result2 == 0)
{
echo "NO RECORDS FOUND FOR THIS PHARMACY";
}
else
{
?>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse; padding-left: 10; padding-right: 10; padding-top: 2; padding-bottom: 2" bordercolor="#EEEEEE" width="50%" id="AutoNumber2" align="left">
<tr bgcolor = "#086AA3">
<td width="50%"><font class='b8w'>Last Name, First Name</td>
<td width="25%"><font class='b8w'>Position</td>
<td width="25%"><font class='b8w'>Details</td>
</tr>
<tr bgcolor = "<? echo $color; ?>">
<td width="50%"><? echo $p_row[l_name]; ?>, <? echo $p_row[f_name]; ?></td>
<td width="25%"><? echo $p_row[app_position]; ?> </td>
<td width="25%"><a href="#">Details</a></td>
</tr>
</table>
<?
}
?>
I've reworked the initial query and it still doesn't seem to work... When I enter a record that should have no associative data instead of getting the "echo "NO RECORDS FOUND FOR THIS PHARMACY";" I get an empty table? 😕