无法从多个MySQL表中查询数据

时间:2014-05-13 21:21:03

标签: php mysql multiple-databases

连接多个表时遇到一些问题,请参阅下面的代码:

<?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仍会显示所有内容。

有谁知道出了什么问题?

0 个答案:

没有答案