Php code dont return data
Posted: Sat Nov 12, 2011 5:56 pm
Hi, I have the following tables:
topic
But returns repeadeatly the same problems in each topic.... how i can fix it. ... thanks for you cooperation
topic
problemstopic_id int(10) AUTO_INCREMENT
sub_id int(10)
topic
THIS IS MY CODE TO GET THE PROBLEMS FROM EACH TOPICproblem_id int(10) AUTO_INCREMENT
topic_id int(10)
problem
Code: Select all
<?php
login();
$topic_id = $_GET['cat'];
$query="SELECT problem_id, problem from problems WHERE topic_id=$topic_id ORDER BY problem ASC";
$result=mysql_query($query);
while($row=mysql_fetch_array($result,MYSQL_ASSOC))
{
$problem_id = $row['problem_id'];
$problem = $row['problem'];
echo "<h3><a href=\"index.php?content=answers&cat=$topic_id\">$problem</a></h3><br>\n";
}
?>