Update database.php
This commit is contained in:
parent
68877fbb97
commit
ac6cba6e50
|
@ -13,16 +13,7 @@ $conn->query("SET NAMES 'utf8'");
|
||||||
|
|
||||||
if(!function_exists("sql_query")) {
|
if(!function_exists("sql_query")) {
|
||||||
function sql_query($sql, $bind=array()) {
|
function sql_query($sql, $bind=array()) {
|
||||||
global $conn;
|
return get_db_stmt($sql, $bind);
|
||||||
|
|
||||||
$stmt = $conn->prepare($sql);
|
|
||||||
if(count($bind) > 0) {
|
|
||||||
foreach($bind as $k=>$v) {
|
|
||||||
$stmt->bindParam(':' . $k, $v);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $stmt;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,5 +72,16 @@ function exec_db_query($sql, $bind=array(), $options=array()) {
|
||||||
return $flag;
|
return $flag;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function exec_db_fetch_all($sql, $bind=array()) {
|
||||||
|
$rows = array();
|
||||||
|
$stmt = get_db_stmt($sql, $bind);
|
||||||
|
|
||||||
|
if($stmt->execute() && $stmt->rowCount() > 0) {
|
||||||
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $rows;
|
||||||
|
}
|
||||||
|
|
||||||
// set global db connection variable
|
// set global db connection variable
|
||||||
$dbc = get_db_connect();
|
$dbc = get_db_connect();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user