Skip to content

Commit ce6a1fe

Browse files
author
ethan
committed
queryScalar
1 parent adf05de commit ce6a1fe

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ public function queryScalar($sql, $params = array())
222222
$statement->execute($params);
223223
$this->logQuery($sql, $params, $this->getElapsedTime($start));
224224
$data = $statement->fetch(PDO::FETCH_NUM);
225-
if (is_array($data) && isset($data[0])) {
225+
if (is_array($data) && count($data) > 0) {
226226
return $data[0];
227227
}
228228
throw new Exception(__CLASS__ . '::queryScalar() fetch result set error.');

0 commit comments

Comments
 (0)