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 8194427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:49:21+00:00 2026-06-07T04:49:21+00:00

Using the example I found here I’m using the code below to create a

  • 0

Using the example I found here I’m using the code below to create a table with PHP. However when I run this, I receive the following error:

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homepages/2/d333603417/htdocs/locationsconsole.php on line 94

Line 94 of my code is while (($row = mysql_fetch_assoc($query)) !== false) {

Could someone perhaps tell me please, have I interpreted the code wrongly, or is there an error with code. I just wondered whether someone could perhaps take a look at this please and provide a little guidance on how I can rectify this issue.

<form name="locationsconsole" id="locationsconsole" method="post" action="locationsaction.php">
<?php
$query = "SELECT  l.*, COUNT(f.locationid) totalfinds FROM detectinglocations l LEFT JOIN finds f ON f.locationid = l.locationid WHERE l.userid = '27'  GROUP BY l.locationname";
?>

<table>
<thead>
<tr>
    <th width="62"><div align="center">Location Name</div></th>
    <th width="120"><div align="left">Location Address</div></th>
    <th width="81"><div align="center">No. Of Finds Made </div></th>                            
</tr>
</thead>
<tbody>
<?php
    while (($row = mysql_fetch_assoc($query)) !== false) {
?>
<tr>
<td><?php echo $row['locationname']; ?></td>
  <td><?php echo $row['returnedaddress']; ?></td>
    <td><?php echo $row['totalfinds']; ?></td>
    </tr>
<?php
}
?>
</tbody>
</table>
</form> 
  • 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-07T04:49:26+00:00Added an answer on June 7, 2026 at 4:49 am

    You need to actually perform the query before fetching the results, using mysql_query:

    $sql = "SELECT  l.*, COUNT(f.locationid) totalfinds FROM detectinglocations l LEFT JOIN finds f ON f.locationid = l.locationid WHERE l.userid = '27'  GROUP BY l.locationname";
    $query = mysql_query($sql);
    

    However, please note that the mysql_ extensions are discouraged and will be removed in future versions of PHP, so I suggest you switch to PDO or MySQLi if at all possible.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I found an example here to create a select list with optgroups using KnockoutJS.
I'm trying to run the basic starter example for using rspec found here: http://rspec.info/
I am looking at an example found here: http://perlmeme.org/tutorials/sort_function.html And it gives this code
I'm using the example found here: http://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_Text_Rendering_01 The issue is that when I specify
I'm so close! I'm using the XNA Game State Management example found here and
I am using the jQuery spinner tool found here: http://btburnett.com/spinner/example/example.html When I try using
I found how to fix div position using jQuery. Here is an example .
I'm using the following example I found on the internet to dynamically build a
I have found the example of using the local sockets . The code from
I'm trying to implement this basic example found here : under the section titled

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.