好的,我知道这应该很容易,但我正在绕圈子。我有两个表,每个运行查询的两个函数,第一个函数获取产品,第二个函数获取产品的图像
我想得到一个数组,它是产品,它的图像......
这是我的代码...
/**
* Gets the requested product from the DB
*
* @param string $productUrl
* @param string $productID
*/
private function _db_get_product($productUrl = null, $productID = null) {
if (empty($productUrl) && empty($productID))
return;
$db = $this->getConnection();
$q = "SELECT " . $this->_leaf_sql_fields() .
" FROM content_products_items pr WHERE pr.productStatus >= "
. menuMachine::getMinimumStatus() . " ";
if (!empty($productUrl))
$q .= " AND productUrl = '" . $productUrl . "'";
if (!empty($productID))
$q .= " AND productID = '" . $productID . "'";
if ($res = $db->recordsetSingle($q))
$this->_product = $res;
return $res;
}
/**
* Get the images for the product
* @return array
*/
private function _db_get_product_images($productID) {
$db = $this->getConnection();
$q = "SELECT * FROM content_products_images WHERE productID = '" . $productID . "'";
$this->_productImages = $db->recordset($q);
}