连接多个表时遇到一些问题,请参阅下面的代码:
<?php
require $_SERVER['DOCUMENT_ROOT'].'/core/init.php';
$vps = DB::getInstance()->query("SELECT * FROM vp WHERE vp_id = 1");
foreach($vps->results() as $vp){
$name = escape($vp->name);
}
$vpSlides = DB::getInstance()->query("SELECT * FROM vp_ss WHERE vp_id = 1 ORDER BY vp_ss_order ASC");
//$vpDays = DB::getInstance()->query("SELECT * FROM vp_itinerary WHERE vp_id = 1 ORDER BY day ASC");
?>
这很好用,我可以在我的页面中使用HTML中的数据,但是一旦我取消注释这行就会丢失数据:
//$vpDays = DB::getInstance()->query("SELECT * FROM vp_itinerary WHERE vp_id = 1 ORDER BY day ASC");
$vpSlides
数据已消失,但var_dump
仍会显示所有内容。
有谁知道出了什么问题?