我正在尝试使用第一个数组的第二个数据库查询运行 2 个数据库查询,任何人都知道为什么这会阻止页面加载?
$query = $this->db->query("SELECT category_id FROM listings WHERE listing_id = '1' LIMIT 1");
foreach ($query->result() as $row)
{
$query2 = $this->db->query("SELECT listing_title FROM listings WHERE listing_type = '".$row->category_id."' ORDER BY RAND() LIMIT 2");
foreach ($query2->result() as $row)
{
echo $row->listing_title;
}
}