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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:50:08+00:00 2026-05-25T19:50:08+00:00

I am trying to sort all of this information into a small table which

  • 0

I am trying to sort all of this information into a small table which I looked up on a tutorial, however I am having problems :/

I had this originally:

$sql = "SELECT * FROM venues WHERE id IN (" . implode(",",$aVenues) . ")";
$comma_separated = implode(",", $aVenues);
echo $comma_separated;

// Execute query and fetch result rowset
$result = mysql_query($sql);
if ($result) {
  $rowset = array();
  while ($row = mysql_fetch_array($result)) {
    $rowset[] = $row;
  }
  var_dump($rowset);
}
else echo mysql_error();

And I changed it to this:

$sql = "SELECT * FROM venues WHERE id IN (" . implode(",",$aVenues) . ")";
$comma_separated = implode(",", $aVenues);
echo $comma_separated;

// Execute query and fetch result rowset
$result = mysql_query($sql);
if ($result) {
  $rowset = array();
  while ($row = mysql_fetch_array($result)) {
    $rowset[] = $row;
  }

  echo "<table border='1'>";
echo "<tr> <th>Name</th> <th>Age</th> </tr>";
// keeps getting the next row until there are no more to get
while($row = mysql_fetch_array( $rowset)) {
    // Print out the contents of each row into a table
    echo "<tr><td>"; 
    echo $row['VENUE_NAME'];
    echo "</td><td>"; 
    echo $row['ADDRESS'];
    echo "</td></tr>"; 
} 

echo "</table>";



}
else echo mysql_error();

…and this is the error I am getting now :/

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/nightl7/public_html/demos/autocompletejquery/index.php on line 66

I also tried changing

while($row = mysql_fetch_array( $rowset))

to

while($row = mysql_fetch_array( $result))

but all that did was make the error disappear, but the rows weren’t being displayed. Thanks everyone :))))!

  • 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-05-25T19:50:09+00:00Added an answer on May 25, 2026 at 7:50 pm

    You are looking to loop over a result array ($rowset) and create a table. There are a few ways to modify this, but the easiest is:

    Change

    while($row = mysql_fetch_array( $rowset)) {
    

    to

    foreach ($rowset as $row) {
    

    And keep the rest as it is.

    So the second while loop becomes:

    foreach ($rowset as $row) {
        // Print out the contents of each row into a table
        echo "<tr><td>"; 
        echo $row['VENUE_NAME'];
        echo "</td><td>"; 
        echo $row['ADDRESS'];
        echo "</td></tr>"; 
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to find all permutations of a string and sort them alphabetically. This
Trying to sort this array of objects according to (1) depth and (2) weight,
we're trying to sort out some conventions for handling dependencies with code checked into
i'm trying to access alarm provider to get all enabled alarm information. so i
I`m trying to create a small bootstrap in php. my dirs are like this:
I am having some problems while trying to create integration tests with Selenium and
So I'm trying to sort an array of pointers as seen below. The problem
I am trying to sort a dict based on its key and return an
I am trying to sort a list using delegates but I am getting a
I am trying to sort large inputs in the fastest way in ascending order.

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.