我有以下的PHP
$manufacturers_query_raw = "select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from " . TABLE_MANUFACTURERS . " order by manufacturers_name";
$manufacturers_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS_ADMIN, $manufacturers_query_raw, $manufacturers_query_numrows);
$manufacturers_query = tep_db_query($manufacturers_query_raw);
while ($manufacturers = tep_db_fetch_array($manufacturers_query))
{
if ((!isset($HTTP_GET_VARS['mID']) || (isset($HTTP_GET_VARS['mID']) && ($HTTP_GET_VARS['mID'] == $manufacturers['manufacturers_id']))) && !isset($mInfo) && (substr($action, 0, 3) != 'new')) {
$manufacturer_products_query = tep_db_query("select count(*) as products_count from " . TABLE_PRODUCTS . " where manufacturers_id = '" . (int)$manufacturers['manufacturers_id'] . "'");
$manufacturer_products = tep_db_fetch_array($manufacturer_products_query);
$mInfo_array = array_merge($manufacturers, $manufacturer_products);
$mInfo = new objectInfo($mInfo_array);
}
我在网页上收到以下错误:
1064 - 您的SQL语法出错;检查与MySQL服务器版本对应的手册,以便在第1行的“select manufacturers_id,manufacturers_name,manufacturers_image,date_added,la”附近使用正确的语法
选择计数(选择manufacturer_id,manufacturer_name,manufacturer_image,date_added,last_modified,由manufacturer_name制造商订购)作为总计
请帮忙。非常感谢。
答案 0 :(得分:0)
我不明白在SELECT COUNT()中需要你的附加select语句吗?
select count(*) as total
会做同样的事情:
select count(select manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified from manufacturers order by manufacturers_name) as total
(如果有效)