public static function getPressRelease()
{
$res = Db::getInstance()->executeS('
SELECT az.id_album, az.type, az.description, az.id_custom_pages, as.id_image, as.id_album , as.youtube, cp.custom_page_type, cp.title_custom_page
FROM `'._DB_PREFIX_.'azgallery_album` AS az
LEFT JOIN `'._DB_PREFIX_.'azgallery` AS ag
LEFT JOIN `'._DB_PREFIX_.'custom_pages` AS cp WHERE cp.custom_page_type = 'gallery'');
return $res;
}
这一行给我带来了错误 解析错误:语法错误,第121行的process.php中的意外T_STRING
答案 0 :(得分:0)
您的最后一行是使用'
作为图库字符串,它会破坏整个SQL字符串。请尝试以下方法:
public static function getPressRelease()
{
$res = Db::getInstance()->executeS('
SELECT az.id_album, az.type, az.description, az.id_custom_pages, as.id_image, as.id_album , as.youtube, cp.custom_page_type, cp.title_custom_page
FROM `'._DB_PREFIX_.'azgallery_album` AS az
LEFT JOIN `'._DB_PREFIX_.'azgallery` AS ag
LEFT JOIN `'._DB_PREFIX_.'custom_pages` AS cp WHERE cp.custom_page_type = "gallery"');
return $res;
}
答案 1 :(得分:0)
你有单引号。
对查询的最后一段使用双引号,如下所示:
public static function getPressRelease()
{
$res = Db::getInstance()->executeS('
SELECT az.id_album, az.type, az.description, az.id_custom_pages, as.id_image, as.id_album , as.youtube, cp.custom_page_type, cp.title_custom_page
FROM `'._DB_PREFIX_.'azgallery_album` AS az
LEFT JOIN `'._DB_PREFIX_.'azgallery` AS ag
LEFT JOIN `'._DB_PREFIX_.'custom_pages` AS cp WHERE cp.custom_page_type = ' . "'gallery'");
return $res;
}