User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 402,689 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,397 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting

mysql_fetch_array for multiple tables

Join Date: Dec 2007
Posts: 14
Reputation: webguru07 is an unknown quantity at this point 
Rep Power: 1
Solved Threads: 1
webguru07 webguru07 is offline Offline
Newbie Poster

mysql_fetch_array for multiple tables

  #1  
Apr 24th, 2008
I need to get information from 2 tables in the same mysql database

  1. $sql = mysql_query("SELECT * FROM notes, customers WHERE `to`='next' LIMIT 5");
  2.  
  3. while($a = mysql_fetch_array($sql)){
  4.  
  5. $row_color = ($row_count % 2) ? "#EFEFEF" : "#FFFFFF";
  6.  
  7. echo("<tr bgcolor=\"$row_color\">
  8. <td height=\"25\">" . $a['custid'] . "</td>
  9. <td height=\"25\">" . $a['name'] . "</td>
  10. <td>" . $a['ebay'] . "</td>
  11. <td>" . $a['title'] . "</td>
  12. <td>" . $a['type'] . "</td>
  13. </tr>");
  14.  
  15. $row_count++;
  16. }

The name and ebay fields are in the customer table and the rest are in the notes table. The code above doesnt produce any error just no rows are displayed
AddThis Social Bookmark Button
Reply With Quote  
All times are GMT -4. The time now is 5:18 am.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC