正如您从下面的代码中看到的那样,我正在尝试执行附加查询。
我在执行第二个查询时遇到问题。似乎代码无法识别第二个查询。有人可以请教吗?
提前致谢。
$query = "SELECT * FROM tst WHERE status ='active' order by created DESC LIMIT 9";
$result = mysql_query($query);
if (!$result) die ("database access failed : " . mysql_error());
while($row = mysql_fetch_array($result))
{
echo"<ul class='gallery'><li>";
echo "<td>" . $row['adid'] . "</td>";
$subquery = ("SELECT * FROM match_item_image where adid = '.$row['adid'].' LIMIT 1 ");
$results = mysql_query($subquery) or die ("Error in query: $subquery " . mysql_error());
$rows = mysql_fetch_array($results);
$rows = mysql_num_rows($results);
echo ' <a href="viewad.php?adid='.$row['adid'].'&subcat='.$row['subcat'].'"> <img src= "upload/'.$rows['image'].'"height="175" width="200"border="0" /> </a> ';
echo "<h2><a href=''>".$row['state'] . "</a></h2>";
echo "<h2><a href=''>".$row['loc'] . "</a></h2>";
echo"
</li>
</ul>";
}