Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8168887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T20:40:20+00:00 2026-06-06T20:40:20+00:00

I wonder whether someone may be able to help me please. Firstly my apologies.

  • 0

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>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td colspan='6'><div align='center'><strong>There are no records set up</strong></div></td>
            <td>&nbsp;</td>
         </tr>
         <tr>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T20:40:23+00:00Added an answer on June 6, 2026 at 8:40 pm

    As pointed out by both @Bulk and @ShawnVaser there was a problem with my query. This is the solution:

    Query

    $query = "SELECT  l.*, COUNT(f.locationid) as totalfinds FROM detectinglocations l LEFT JOIN finds f ON f.locationid = l.locationid WHERE l.userid = '28' GROUP BY l.locationname"; 
    $result = mysql_query($query);  
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I wonder whether someone may be able to help me please. Firstly, apologies because
I wonder whether someone may be able to help me please Firstly, my apologies
I wonder whether someone may be able to help me please. Firstly apologies as
I wonder whether someone may be able to help me please. Firstly, my apologies
I wonder whether someone may be able to help me please. Firstly, this is
I wonder whether someone may be able to help me please. Firstly apologies, because
I wonder whether someone may be able to help me please. Firstly, apologies, I'm
I wonder whether someone may be able to help me please. I'm using this
I wonder whether someone may be able to help me please. I'm using this
I wonder whether someone may be able to help me please. Firstly, my sincere

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.