在线等..高手们帮帮忙..小弟万分感谢..

#1 lwd5400

为什么一直提示语法错误 , 我换个原来数据库有数据表就没错..但新键任何表都会显示这个错.. SELECT COUNT() as sp_counter FROM dw_aop
执行错误: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') as sp_counter FROM dw_aop' at line 1
  • F:\php\wamp\www\dwkj2\SpeedPHP\Drivers\mysql.php on line 69
64.
{
65.         $this->arrSql[] = $sql;
66.
if( $result = mysql_query($sql, $this->conn) ){
67.
return $result;
68.
}else{
69.             spError("{$sql}
执行错误: "
. mysql_error());

70.
}
71.
}
72.
73.
/**
74.
* 返回影响行数

  • F:\php\wamp\www\dwkj2\SpeedPHP\Drivers\mysql.php on line 33
28.
* @param sql  执行的SQL语句
29.
*/
30.
public function getArray($sql)
31.
{
32.         $this->arrSql[] = $sql;
33.
if( ! $result = $this->exec($sql) )return FALSE;

34.
if( ! mysql_num_rows($result) )return FALSE;
35.         $rows = array();
36.
while($rows[] = mysql_fetch_array($result,MYSQL_ASSOC)){}
37.         mysql_free_result($result);
38.         array_pop($rows);

  • F:\php\wamp\www\dwkj2\SpeedPHP\Core\spModel.php on line 263
258.
}else{
259.
if(null != $conditions)$where = "WHERE ".$conditions;
260.
}//////////////////////////////////////////////////
261.         $sql = "SELECT COUNT({$this->pk}) as sp_counter FROM {$this->tbl_name} {$where}";
262.
echo '';
263.         $result = $this->_db->getArray($sql);

264.
return $result[0]['sp_counter'];
265.
}
266.
267.
/**
268.
* 魔术函数,执行模型扩展类的自动加载及使用


2010-12-03 12:42:05

#2 jake

这样看不是很清楚的,看不到是什么代码出现问题。

你可以检查一下,dw_aop类的pk主键有没有设置了

2010-12-03 13:49:48