I wonder whether someone may be able to help me please.
Firstly my apologies. I would have liked to provide a link to this rather than printing the code below, but I need this to run off my live server tables.
I'm using the code below to generate a table of all location records pertinent to the current user.
<form name="locationsconsole" id="locationsconsole" method="post" action="locationsaction.php">
<table width="864" cellpadding="0" cellspacing="0">
<thead>
<tr>
<th width="17"></th>
<th width="99"><div align="center">Location Name</div></th>
<th width="287"><div align="left">Location Address</div></th>
<th width="88"><div align="center">No. Of Finds Made </div></th>
<th width="86"></th>
<th width="72"></th>
<th width="84"></th>
</tr>
</thead>
<tbody>
<?php
$query = "SELECT l.locationid, f.locationid, l.locationname, l.userid, l.returnedaddress, count(f.locationid) as totalfinds FROM detectinglocations as l left join finds as f on l.locationid=f.locationid WHERE l.userid='$idnum' ORDER BY l.locationname";
$result = mysql_query($query) or die('error');
if (mysql_num_rows($result) == 0)
echo"<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan='6'><div align='center'><strong>There are no records set up</strong></div></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>";
else
{
while($obj=mysql_fetch_object($result))
{
?>
<tr>
<td><input type="hidden" name="lid" value="<?php echo $obj->locationid;?>"/></td>
<td><div align="center"><?php echo $obj->locationname;?></div></td>
<td><div align="left"><?php echo $obj->returnedaddress;?></div></td>
<td><div align="center"><?php echo $obj->totalfinds;?></div></td>
<td><div align="center"><input name="type" type="submit" value="View Details"/></div></td>
<td><div align="center"><input name="type" type="submit" value="Add Finds"/></div></td>
<td><div align="center"><input name="type" type="submit" value="Add Images"/></div></td>
<td width="129"><div align="left"><input name="type" type="submit" value="View Location Finds"/></div></td>
</tr>
<?php
}
}
?>
</tbody>
</table>
</form>
Although the query is retrieving the right information and the buttons on the row work, the problem I'm having is that although there should 3 records shown in the list, only the first is shown.
I'm the first to admit that I'm certainly no expert when it comes to PHP, but I've been working on this for days and written the script many, many times, but I just can't seem to find a solution.
I just wondered whether someone could possibly look at this please and let me know where I'm going wrong.