PHP格式错误的查询SQL 1064错误


PHP malformed query SQL 1064 error

我有以下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语法出现错误;在第1行的"select manufacturers_id,manufacturers _name,manufacture rs_image,date_aded,la"附近,查看与MySQL服务器版本对应的手册,以获得正确的语法

选择count(按制造商名称从制造商订单中选择制造商id、制造商名称、制造商图像、日期、最后修改)作为总

请帮忙。非常感谢。

我不明白在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

(如果有效)