Exception: flea_db_exception_sqlquery
Message: SQL 错误消息: "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 '' at line 3"
SQL 语句: "SELECT COUNT(`shop_comments`.`comment_id`)
FROM `shop_comments`
WHERE shop_id = "
SQL 错误代码: "7335941".
Filename: /var/www/html/hsj/home/FLEA/FLEA/Db/Driver/Mysql.php
#9
flea_db_exception_sqlquery::flea_db_exception_sqlquery('SELECT COUNT(`shop_comments ...', 'You have an error in your S ...', 1064)
FILE: Mysql.php
LINE: 230
ARGS:
Array
(
[0] => SELECT COUNT(`shop_comments`.`comment_id`)
FROM `shop_comments`
WHERE shop_id =
[1] => 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 '' at line 3
[2] => 1064
)
SOURCE CODE:
| 220 |
if ($result !== false) {
|
| 221 |
$this->lasterr = null;
|
| 222 |
$this->lasterrcode = null;
|
| 223 |
return $result;
|
| 224 |
}
|
| 225 |
$this->lasterr = mysql_error($this->conn);
|
| 226 |
$this->lasterrcode = mysql_errno($this->conn);
|
| 227 |
if (!$throw) { return false; }
|
| 228 |
|
| 229 |
FLEA::loadClass('FLEA_Db_Exception_SqlQuery');
|
| 230 |
__THROW(new FLEA_Db_Exception_SqlQuery($sql, $this->lasterr, $this->lasterrcode));
|
| 231 |
return false;
|
| 232 |
}
|
| 233 |
|
| 234 |
/**
|
| 235 |
* 转义字符串
|
| 236 |
*
|
| 237 |
* @param string $value
|
| 238 |
*
|
| 239 |
* @return mixed
|
| 240 |
*/
|
Filename: /var/www/html/hsj/home/FLEA/FLEA/Db/Driver/Mysql.php
#8
flea_db_driver_mysql::execute('SELECT COUNT(`shop_comments ...')
FILE: Mysql.php
LINE: 614
ARGS:
Array
(
[0] => SELECT COUNT(`shop_comments`.`comment_id`)
FROM `shop_comments`
WHERE shop_id =
)
SOURCE CODE:
| 604 |
*
|
| 605 |
* @param string|resource $sql
|
| 606 |
*
|
| 607 |
* @return mixed
|
| 608 |
*/
|
| 609 |
function getOne($sql)
|
| 610 |
{
|
| 611 |
if (is_resource($sql)) {
|
| 612 |
$res = $sql;
|
| 613 |
} else {
|
| 614 |
$res = $this->execute($sql);
|
| 615 |
}
|
| 616 |
$row = mysql_fetch_row($res);
|
| 617 |
mysql_free_result($res);
|
| 618 |
return isset($row[0]) ? $row[0] : null;
|
| 619 |
}
|
| 620 |
|
| 621 |
/**
|
| 622 |
* 执行查询,返回第一条记录
|
| 623 |
*
|
| 624 |
* @param string|resource $sql
|
Filename: /var/www/html/hsj/home/FLEA/FLEA/Db/TableDataGateway.php
#7
flea_db_driver_mysql::getone('SELECT COUNT(`shop_comments ...')
FILE: TableDataGateway.php
LINE: 553
ARGS:
Array
(
[0] => SELECT COUNT(`shop_comments`.`comment_id`)
FROM `shop_comments`
WHERE shop_id =
)
SOURCE CODE:
| 543 |
*/
|
| 544 |
function findCount($conditions = null, $fields = null)
|
| 545 |
{
|
| 546 |
list($whereby, $distinct) = $this->getWhere($conditions);
|
| 547 |
if ($fields == null) {
|
| 548 |
$fields = $this->qpk;
|
| 549 |
} else {
|
| 550 |
$fields = $this->dbo->qfields($fields, $this->fullTableName);
|
| 551 |
}
|
| 552 |
$sql = "SELECT {$distinct}COUNT({$fields})\nFROM {$this->qtableName}{$whereby}";
|
| 553 |
return (int)$this->dbo->getOne($sql);
|
| 554 |
}
|
| 555 |
|
| 556 |
/**
|
| 557 |
* 保存数据到数据库
|
| 558 |
*
|
| 559 |
* 如果数据包含主键值,则 save() 会调用 update() 来更新记录,否则调用 create() 来创建记录。
|
| 560 |
*
|
| 561 |
* @param array $row
|
| 562 |
* @param boolean $saveLinks
|
| 563 |
*
|
Filename: /var/www/html/hsj/home/FLEA/FLEA/Helper/Pager.php
#6
model_shopcomments::findcount('shop_id = ')
FILE: Pager.php
LINE: 200
ARGS:
Array
(
[0] => shop_id =
)
SOURCE CODE:
| 190 |
function FLEA_Helper_Pager(& $source, $currentPage, $pageSize = 20,
|
| 191 |
$conditions = null, $sortby = null)
|
| 192 |
{
|
| 193 |
$this->currentPage = $currentPage;
|
| 194 |
$this->pageSize = $pageSize;
|
| 195 |
|
| 196 |
if (is_object($source)) {
|
| 197 |
$this->source =& $source;
|
| 198 |
$this->_conditions = $conditions;
|
| 199 |
$this->_sortby = $sortby;
|
| 200 |
$this->count = $this->source->findCount($conditions);
|
| 201 |
if ($conditions == null) {
|
| 202 |
$this->totalCount = $this->count;
|
| 203 |
} else {
|
| 204 |
$this->totalCount = $this->source->findCount();
|
| 205 |
}
|
| 206 |
$this->_computingPage();
|
| 207 |
} else {
|
| 208 |
$this->source = $source;
|
| 209 |
}
|
| 210 |
}
|
Filename: /var/www/html/hsj/home/APP/Controller/shop.php
#5
flea_helper_pager::flea_helper_pager(model_shopcomments, 0, 20, 'shop_id = ', 'created desc')
FILE: shop.php
LINE: 119
ARGS:
Array
(
[0] => model_shopcomments Object
(
[tableName] => shop_comments
[fullTableName] => shop_comments
[primaryKey] => comment_id
[hasOne] =>
[belongsTo] =>
[hasMany] =>
[manyToMany] =>
[meta] => Array
(
[COMMENT_ID] => Array
(
[name] => comment_id
[scale] =>
[type] => int
[maxLength] => 11
[simpleType] => R
[notNull] => 1
[primaryKey] => 1
[autoIncrement] => 1
[binary] =>
[unsigned] =>
[hasDefault] =>
)
[SHOP_ID] => Array
(
[name] => shop_id
[scale] =>
[type] => int
[maxLength] => 11
[simpleType] => I
[notNull] => 1
[primaryKey] =>
[autoIncrement] =>
[binary] =>
[unsigned] =>
[hasDefault] => 1
[defaultValue] => 0
)
[CONTENT] => Array
(
[name] => content
[scale] =>
[type] => text
[maxLength] => -1
[simpleType] => X
[notNull] => 1
[primaryKey] =>
[autoIncrement] =>
[binary] =>
[unsigned] =>
[hasDefault] =>
)
[REPLY] => Array
(
[name] => reply
[scale] =>
[type] => text
[maxLength] => -1
[simpleType] => X
[notNull] => 1
[primaryKey] =>
[autoIncrement] =>
[binary] =>
[unsigned] =>
[hasDefault] =>
)
[MEMBER_ID] => Array
(
[name] => member_id
[scale] =>
[type] => int
[maxLength] => 11
[simpleType] => I
[notNull] => 1
[primaryKey] =>
[autoIncrement] =>
[binary] =>
[unsigned] =>
[hasDefault] => 1
[defaultValue] => 0
)
[CREATED] => Array
(
[name] => created
[scale] =>
[type] => int
[maxLength] => 11
[simpleType] => I
[notNull] => 1
[primaryKey] =>
[autoIncrement] =>
[binary] =>
[unsigned] =>
[hasDefault] => 1
[defaultValue] => 0
)
[UPDATED] => Array
(
[name] => updated
[scale] =>
[type] => int
[maxLength] => 11
[simpleType] => I
[notNull] => 1
[primaryKey] =>
[autoIncrement] =>
[binary] =>
[unsigned] =>
[hasDefault] => 1
[defaultValue] => 0
)
)
[autoValidating] =>
[verifier] =>
[createdTimeFields] => Array
(
[0] => CREATED
[1] => CREATED_ON
[2] => CREATED_AT
)
[updatedTimeFields] => Array
(
[0] => UPDATED
[1] => UPDATED_ON
[2] => UPDATED_AT
)
[autoLink] => 1
[dbo] => flea_db_driver_mysql Object
(
[NEXT_ID_SQL] => UPDATE %s SET id = LAST_INSERT_ID(id + 1)
[CREATE_SEQ_SQL] => CREATE TABLE %s (id INT NOT NULL)
[INIT_SEQ_SQL] => INSERT INTO %s VALUES (%s)
[DROP_SEQ_SQL] => DROP TABLE %s
[TRUE_VALUE] => 1
[FALSE_VALUE] => 0
[NULL_VALUE] => NULL
[META_COLUMNS_SQL] => SHOW COLUMNS FROM %s
[dsn] => Array
(
[driver] => mysql
[host] => localhost
[login] => hsj
[password] => hsj@!@#$%^
[database] => hsjmain
[port] =>
[options] =>
[dbTablePrefix] =>
[id] => mysql://hsj:hsj@!@#$%^@localhost_/hsjmain/
)
[conn] => Resource id #16
[log] => Array
(
[0] => SELECT VERSION()
[1] => SET NAMES 'utf8'
[2] => SELECT `shop_profile`.*
FROM `shop_profile`
WHERE urlpath='hsj390'
LIMIT 1
[3] => UPDATE `shop_profile`
SET `shop_profile`.`views` = `shop_profile`.`views` + 1, `shop_profile`.`updated` = '1219366937'
[4] => SELECT COUNT(`shop_comments`.`comment_id`)
FROM `shop_comments`
WHERE shop_id =
)
[enableLog] => 1
[lasterr] => 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 '' at line 3
[lasterrcode] => 1064
[_insertId] =>
[_transCount] => 0
[_transCommit] => 1
)
[links] => Array
(
[MEMBER_INFO] => flea_db_belongstolink Object
(
[name] => member_info
[tableClass] => Model_Members
[foreignKey] => member_id
[mappingName] => member_info
[recordObjectClass] =>
[oneToOne] => 1
[type] => 2
[sort] =>
[conditions] =>
[fields] => username
[limit] =>
[enabled] => 1
[linkRead] => 1
[linkCreate] => 1
[linkUpdate] => 1
[linkRemove] => 1
[linkRemoveFillValue] => 0
[saveAssocMethod] => save
[mainTDG] => *RECURSION*
[assocTDG] =>
[_req] => Array
(
[0] => name
[1] => tableClass
[2] => mappingName
)
[_optional] => Array
(
[0] => foreignKey
[1] => sort
[2] => conditions
[3] => fields
[4] => limit
[5] => enabled
[6] => linkRead
[7] => linkCreate
[8] => linkUpdate
[9] => linkRemove
[10] => linkRemoveFillValue
[11] => recordObjectClass
[12] => saveAssocMethod
)
[qforeignKey] =>
[dbo] => flea_db_driver_mysql Object
(
[NEXT_ID_SQL] => UPDATE %s SET id = LAST_INSERT_ID(id + 1)
[CREATE_SEQ_SQL] => CREATE TABLE %s (id INT NOT NULL)
[INIT_SEQ_SQL] => INSERT INTO %s VALUES (%s)
[DROP_SEQ_SQL] => DROP TABLE %s
[TRUE_VALUE] => 1
[FALSE_VALUE] => 0
[NULL_VALUE] => NULL
[META_COLUMNS_SQL] => SHOW COLUMNS FROM %s
[dsn] => Array
(
[driver] => mysql
[host] => localhost
[login] => hsj
[password] => hsj@!@#$%^
[database] => hsjmain
[port] =>
[options] =>
[dbTablePrefix] =>
[id] => mysql://hsj:hsj@!@#$%^@localhost_/hsjmain/
)
[conn] => Resource id #16
[log] => Array
(
[0] => SELECT VERSION()
[1] => SET NAMES 'utf8'
[2] => SELECT `shop_profile`.*
FROM `shop_profile`
WHERE urlpath='hsj390'
LIMIT 1
[3] => UPDATE `shop_profile`
SET `shop_profile`.`views` = `shop_profile`.`views` + 1, `shop_profile`.`updated` = '1219366937'
[4] => SELECT COUNT(`shop_comments`.`comment_id`)
FROM `shop_comments`
WHERE shop_id =
)
[enableLog] => 1
[lasterr] => 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 '' at line 3
[lasterrcode] => 1064
[_insertId] =>
[_transCount] => 0
[_transCommit] => 1
)
[assocTDGObjectId] =>
[init] =>
)
)
[qtableName] => `shop_comments`
[qpk] => `shop_comments`.`comment_id`
[pka] => flea_pkref_comment_id
[qpka] => `shop_comments`.`comment_id` AS flea_pkref_comment_id
[lastValidationResult] =>
)
[1] => 0
[2] => 20
[3] => shop_id =
[4] => created desc
)
SOURCE CODE:
| 109 |
$pageSize = 20;
|
| 110 |
$conditions = "shop_id = ".$this->shop_id;
|
| 111 |
$link_member = array(
|
| 112 |
'tableClass' => 'Model_Members',
|
| 113 |
'foreignKey' => 'member_id',
|
| 114 |
'mappingName' => 'member_info',
|
| 115 |
'fields' => 'username',
|
| 116 |
);
|
| 117 |
$this->_modelShopComments->createLink($link_member,BELONGS_TO);
|
| 118 |
FLEA::loadClass('FLEA_Helper_Pager');
|
| 119 |
$pager =& new FLEA_Helper_Pager($this->_modelShopComments, $page, $pageSize, $conditions, 'created desc');
|
| 120 |
$comments = $pager->findAll();
|
| 121 |
//dump($comments);
|
| 122 |
$mp_url = "http://www.haoshijia.com.cn/shop/".$this->urlpath."/comments";
|
| 123 |
$seo_title = $this->shop_name."商铺 - 留言";
|
| 124 |
include(TEMPLATE_DIR . 'shop_comments.php');
|
| 125 |
}
|
| 126 |
|
| 127 |
function actioncreatecomments() {
|
| 128 |
$this->path .= " » <a href=\"" . SITE_ROOT . 'shop/' . $this->urlpath . "/\">" . $this->shop_name . "</a> » " . '添加留言';
|
| 129 |
$seo_title = $this->shop_name."商铺-添加留言";
|
Filename: /var/www/html/hsj/home/FLEA/FLEA/Dispatcher/Simple.php
#4
controller_shop::actioncomments()
FILE: Simple.php
LINE: 127
ARGS:
Array
(
)
SOURCE CODE:
| 117 |
}
|
| 118 |
if (method_exists($controller, '__setDispatcher')) {
|
| 119 |
$controller->__setDispatcher($this);
|
| 120 |
}
|
| 121 |
|
| 122 |
// 调用 _beforeExecute() 方法
|
| 123 |
if (method_exists($controller, '_beforeExecute')) {
|
| 124 |
$controller->_beforeExecute($actionMethod);
|
| 125 |
}
|
| 126 |
// 执行 action 方法
|
| 127 |
$ret = $controller->{$actionMethod}();
|
| 128 |
// 调用 _afterExecute() 方法
|
| 129 |
if (method_exists($controller, '_afterExecute')) {
|
| 130 |
$controller->_afterExecute($actionMethod);
|
| 131 |
}
|
| 132 |
return $ret;
|
| 133 |
} while (false);
|
| 134 |
|
| 135 |
if ($callback) {
|
| 136 |
// 检查是否调用应用程序设置的错误处理程序
|
| 137 |
$args = array($controllerName, $actionName, $controllerClass);
|
Filename: /var/www/html/hsj/home/FLEA/FLEA/Dispatcher/Simple.php
#3
flea_dispatcher_simple::_executeaction('shop', 'comments', 'Controller_shop')
FILE: Simple.php
LINE: 77
ARGS:
Array
(
[0] => shop
[1] => comments
[2] => Controller_shop
)
SOURCE CODE:
| 67 |
|
| 68 |
/**
|
| 69 |
* 从请求中分析 Controller、Action 和 Package 名字,然后执行指定的 Action 方法
|
| 70 |
*
|
| 71 |
* @return mixed
|
| 72 |
*/
|
| 73 |
function dispatching()
|
| 74 |
{
|
| 75 |
$controllerName = $this->getControllerName();
|
| 76 |
$actionName = $this->getActionName();
|
| 77 |
return $this->_executeAction($controllerName, $actionName, $this->getControllerClass($controllerName));
|
| 78 |
}
|
| 79 |
|
| 80 |
/**
|
| 81 |
* 执行指定的 Action 方法
|
| 82 |
*
|
| 83 |
* @param string $controllerName
|
| 84 |
* @param string $actionName
|
| 85 |
* @param string $controllerClass
|
| 86 |
*
|
| 87 |
* @return mixed
|
Filename: /var/www/html/hsj/home/FLEA/FLEA.php
#2
flea_dispatcher_simple::dispatching()
FILE: FLEA.php
LINE: 621
ARGS:
Array
(
)
SOURCE CODE:
| 611 |
require_once($MVCPackageFilename);
|
| 612 |
}
|
| 613 |
FLEA::init();
|
| 614 |
|
| 615 |
// 载入调度器并转发请求到控制器
|
| 616 |
$dispatcherClass = FLEA::getAppInf('dispatcher');
|
| 617 |
FLEA::loadClass($dispatcherClass);
|
| 618 |
|
| 619 |
$dispatcher =& new $dispatcherClass($_GET);
|
| 620 |
FLEA::register($dispatcher, $dispatcherClass);
|
| 621 |
$dispatcher->dispatching();
|
| 622 |
}
|
| 623 |
|
| 624 |
/**
|
| 625 |
* 准备运行环境
|
| 626 |
*
|
| 627 |
* @param boolean $loadMVC
|
| 628 |
*/
|
| 629 |
function init($loadMVC = false)
|
| 630 |
{
|
| 631 |
static $firstTime = true;
|
Filename: /var/www/html/hsj/home/home.php
#1
flea::runmvc()
FILE: home.php
LINE: 42
ARGS:
Array
(
)
SOURCE CODE:
| 32 |
//FLEA框架文件
|
| 33 |
require('./FLEA/FLEA.php');
|
| 34 |
//公共函数库
|
| 35 |
require('./functions.php');
|
| 36 |
|
| 37 |
|
| 38 |
//导入框架配置参数
|
| 39 |
FLEA::loadAppInf('./config.php');
|
| 40 |
FLEA::setAppInf('dbDSN',$dsn);
|
| 41 |
FLEA::import(APP_DIR . DS . 'APP');
|
| 42 |
FLEA::runMVC();
|
| 43 |
|
| 44 |
|
| 45 |
?> |