Update database.php
This commit is contained in:
parent
49520296be
commit
1c922bc4b9
|
|
@ -221,8 +221,8 @@ if(!check_function_exists("exec_db_query")) {
|
||||||
if(!check_function_exists("exec_db_fetch_all")) {
|
if(!check_function_exists("exec_db_fetch_all")) {
|
||||||
function exec_db_fetch_all($sql, $bind=array(), $options=array()) {
|
function exec_db_fetch_all($sql, $bind=array(), $options=array()) {
|
||||||
$response = array();
|
$response = array();
|
||||||
|
|
||||||
$length = 0;
|
$length = 0;
|
||||||
|
|
||||||
$rows = array();
|
$rows = array();
|
||||||
$stmt = get_db_stmt($sql, $bind);
|
$stmt = get_db_stmt($sql, $bind);
|
||||||
|
|
||||||
|
|
@ -230,11 +230,11 @@ if(!check_function_exists("exec_db_fetch_all")) {
|
||||||
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Count rows
|
|
||||||
$count_data = exec_db_fetch(sprintf("select count(*) as cnt from (%s)", $sql));
|
|
||||||
$length = get_value_in_array("cnt", $count_data, $length);
|
|
||||||
|
|
||||||
if(array_key_equals("do_count", $options, true)) {
|
if(array_key_equals("do_count", $options, true)) {
|
||||||
|
$count_sql = sprintf("select count(*) as cnt from (%s) a", $sql);
|
||||||
|
$count_data = exec_db_fetch($count_sql);
|
||||||
|
$length = get_value_in_array("cnt", $count_data, $length);
|
||||||
|
|
||||||
$response = array(
|
$response = array(
|
||||||
"length" => $length,
|
"length" => $length,
|
||||||
"data" => $rows,
|
"data" => $rows,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user