zero-perfoliate
zero-perfoliate

Author Topic: struggling!  (Read 713 times)

Offline Amyana

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
struggling!
« on: September 29, 2008, 10:16:21 PM »
I have 2 tables in mysql, one is called info and one is called stats.  On my webpage, I'm making a table using information from both of the mysql tables.  I made a field in each mysql table called id so that I could have a reference from one table to another.. I hope that makes sense. 
In any case, I'm trying to write a formula that will allow me to access both tables throughout my webpage.  The related section of my code so far:

Code: [Select]
$results = mysql_query("SELECT * FROM info,stats WHERE info.id = stats.id AND id=$_REQUEST[id]");
echo "<table align=\"center\" border='1' width=\"100%\">";
while($row = mysql_fetch_array($results))
  {
<<<my table codes here- this does work if I only use one table>>>
}
echo "</table>";


Any suggestions? I'm pretty new to php and self-taught, so if I've used any wrong terms or if you need  more information, please let me know.

Thank you.

icestormz

  • Guest
Re: struggling!
« Reply #1 on: October 02, 2008, 11:44:24 PM »
Hey give this a try enter

Code: [Select]
$results = mysql_query("SELECT info, stats FROM info, stats WHERE info.id = stats.id AND id=$_REQUEST[id]");
echo "<table align=\"center\" border='1' width=\"100%\">";
while($row = mysql_fetch_array($results))
  {
<<<my table codes here- this does work if I only use one table>>>
}
echo "</table>";

Offline Amyana

  • New PHP Members
  • Posts: 2
  • Karma: +0/-0
Re: struggling!
« Reply #2 on: October 03, 2008, 03:58:18 AM »
I ended up getting this to work:

Code: [Select]
$results = mysql_query("SELECT * FROM info, stats WHERE info.id=$_REQUEST[id] AND stats.id=$_REQUEST[id] ");
echo "<table align=\"center\" border='1' width=\"100%\">";
while($row = mysql_fetch_array($results))
  {
<<<my table codes here- this does work if I only use one table>>>
}
echo "</table>";

icestormz

  • Guest
Re: struggling!
« Reply #3 on: October 03, 2008, 11:45:42 AM »
Excellent thanks for the reply back

 

zero-perfoliate