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

  • Home
  • SEARCH
  • 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 8673347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T19:26:12+00:00 2026-06-12T19:26:12+00:00

I have a a php website with some code on it to pull from

  • 0

I have a a php website with some code on it to pull from a database after the user has defined some search terms and then show them a table with all their information in it

The problem is even when i do a select * from the tables, i am only getting the first row back.

Code:

$result = mysql_query("SELECT trees.*     
FROM trees 
INNER JOIN price 
ON trees.ID=price.treeid  
");


$num_rows = mysql_num_rows($result);
if($num_rows == 0) {
echo "No rows retrieved";
} else {
echo $num_rows;
}

i have 2 rows in my database:

Spruce  El Sorbeous Sprucious   Green   Green   Green   100     200
its a tree ma!  true    NULL    NULL    NULL

Mayday  el daymay   red green   white   10  4000000
GOING DOWN  true    Grey    true    false

when i print out the $num_rows up there, it is only one.
When i print out my table below, there is only one row:

echo '<table border = 0 cellpadding=0 >';
echo '<tr>';
echo '<td><b><u>Name</b></u></td>
<td><b><u>Latin Name</b></u></td>
<td><b><u>Primary Color</b></u></td>
<td><b><u>Secondary Color</b></u></td>
<td><b><u>Fall Color</b></u></td>
<td><b><u>Trunk Color</b></u></td>';

echo '<td><b><u>Description</b></u></td>
<td><b><u>Height</b></u></td>
<td><b><u>Spread</b></u></td>
<td><b><u>Drought Resistant?</b></u></td>
<td><b><u>Flowering?</b></u></td>
<td><b><u>Fruit Producing?</b></u></td>';

echo '</tr>';

while ($row = mysql_fetch_assoc($result)) {
     echo '<tr>';
     echo '<td>';
     echo $row['name'];
     echo '</td>';
     echo '<td>';
     echo $row['latinname'];
     echo '</td>';
     echo '<td>';
     echo $row['primarycolor'];
     echo '</td>';
     echo '<td>';
     echo $row['secondarycolor'];
     echo '</td>';
     echo '<td>';
     echo $row['fallcolor'];
     echo '</td>';
     echo '<td>';
     echo $row['trunkcolor'];
     echo '</td>';
     echo '<td>';
     echo $row['description'];
     echo '</td>';
     echo '<td>';
     echo $row['height'];
     echo '</td>';
     echo '<td>';
     echo $row['spread'];
     echo '</td>';
     echo '<td>';
     echo $row['droughtresistant'];
     echo '</td>';
     echo '<td>';
     echo $row['flowering'];
     echo '</td>';
     echo '<td>';
     echo $row['fruitproducing'];
     echo '</td>';

     echo '</tr>';

}
echo '<table>';
  • 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-12T19:26:13+00:00Added an answer on June 12, 2026 at 7:26 pm

    Since there’s no example of the data in the PRICE table, I’m guessing that only one row was joined.

    The question remains, why are you doing that JOIN? You’re not collecting any data from the PRICE table, so what’s the point.
    BTW, where in the data is the ID?

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

Sidebar

Related Questions

I have a blog background website. We provide some HTML code that the user
I have some JavaScript code in my php website. This code uses jQuery, and
I have a php script that grabs links from another website. I am storing
I have working website in PHP with a MySQL backend which has several tables
i think this is a classic question, i have some encoded php code in
I have a user who registered on my website with some email and password.
I have some code that embeds a sound file in a website, i was
I am working on a PHP website whose code I inherited from a development
A friend and I have been working on a moderate-sized PHP website for some
I have a code that sends POST data to a PHP website. Code: request

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.