PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I have a simple problem that looks long but is simple I am sure for any experienced programmer on this forum...Any assistance greatly appreciated
I query the database once and fetch the results which are represented by $mosttraffic. Everything is fine and i get 3 unique results listed together. When I use $mosttraffic in the next query I only get one result but I want 3. Anyone got ideas?
query="SELECT td, COUNT(id) AS total FROM box GROUP BY td ORDER BY total DESC LIMIT 50";
$result1=mysql_query($query) or die('Error, select query failed');
while($row = mysql_fetch_array($result1)){
$mosttraffic=$row['td'];
echo $mosttraffic;
$query="SELECT * FROM tc WHERE td='$mosttraffic'";
$result2=mysql_query($query) or die('Error, select query failed');
while($row = mysql_fetch_array($result2)){
echo $row['tt'];
echo "<br />";
}
}
Last edited by scarface222 on Fri Jul 24, 2009 10:41 pm, edited 2 times in total.