Hello All!
I have a small issue that Im sure its due to something minor that I am overlooking but Ive been working on this for hours and cant seem to catch the issue.
Basically I have a query that is looking up locations of a certain type of course.
It looks at a table that lists all locations that are active and returns a list of states where we have courses. The INNER JOIN is transforming the State abbreviation to the proper state name using a table called STATES.
Then its returned to a 4 column table. However for some reason the first location is missing.
On the php page it leaves out the first state (Arizona), but running the same query on PHPMyadmin returns the appropriate states. Here is the code":
Query
mysql_select_db($database_db, $db);
$query_rsLocations = "SELECT DISTINCT
locations.locationstate,
locations.locationstatus,
USStates.statename
FROM
locations
INNER JOIN USStates ON (locations.locationstate=USStates.stateabr)
WHERE
locations.locationstatus = 'active'
ORDER BY
locations.locationstate";
$rsLocations = mysql_query($query_rsLocations, $db) or die(mysql_error());
$row_rsLocations = mysql_fetch_assoc($rsLocations);
$totalRows_rsLocations = mysql_num_rows($rsLocations);
Code for table. THis is where the first record goes missing.
<table class="statelisttable" width="500px" align="center">
<?php $clm = 1;
while($row_rsLocations = mysql_fetch_assoc($rsLocations)){
if($clm == 1){ echo "<tr>"; } ?>
<td><a href="CPR_Classes_In_<?php echo $row_rsLocations['locationstate']; ?>.html">
<?php
$filename = "images/flags/" . $row_rsLocations['locationstate'] . ".jpg";
if (file_exists($filename)) {
echo "<img src=images/flags/" . $row_rsLocations['locationstate'] . ".jpg>";
} else {
echo "<img src=images/flags/US.jpg>";
}?><br>
<?php echo $row_rsLocations['statename']; ?></a></td>
<? if($clm == 4){
echo "</tr>";
$clm = 1;
}else{
$clm++;
}
}
if($clm == 1) { echo "<td> </td></tr>"; }
?>
</table></div>
Really appreciate your help on this before i go nuts!!!
thanks again,