mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Fixed UpadteDB function. It didn't seem to work. I fixed the syntax and hopefullt this won't break other things, but I guess as I test I'll find out.
This commit is contained in:
@ -24,10 +24,10 @@ Usage
|
||||
function dbQuery($sql, $parameters = array()) {
|
||||
global $fullSql, $debug;
|
||||
$fullSql = dbMakeQuery($sql, $parameters);
|
||||
if($debug) {
|
||||
print Console_Color::convert("\nSQL[%y".$fullSql."%n] ");
|
||||
#echo("\nSQL[".$fullSql."] ");
|
||||
}
|
||||
//if($debug) {
|
||||
//print Console_Color::convert("\nSQL[%y".$fullSql."%n] ");
|
||||
//echo("\nSQL[".$fullSql."] ");
|
||||
//}
|
||||
|
||||
/*
|
||||
if($this->logFile)
|
||||
@ -35,6 +35,10 @@ function dbQuery($sql, $parameters = array()) {
|
||||
*/
|
||||
|
||||
$result = mysql_query($fullSql); // sets $this->result
|
||||
if (!empty(mysql_error())) {
|
||||
echo("\nSQL[".$fullSql."] ");
|
||||
print mysql_error();
|
||||
}
|
||||
/*
|
||||
if($this->logFile) {
|
||||
$time_end = microtime(true);
|
||||
@ -114,9 +118,9 @@ function dbUpdate($data, $table, $where = null, $parameters = array()) {
|
||||
|
||||
// need field name and placeholder value
|
||||
// but how merge these field placeholders with actual $parameters array for the WHERE clause
|
||||
$sql = 'UPDATE `' . $table . '` set ';
|
||||
$sql = 'UPDATE `' . $table . '` SET ';
|
||||
foreach($data as $key => $value) {
|
||||
$sql .= "`".$key."` ". '=:' . $key . ',';
|
||||
$sql .= "`".$key."` = '" . $value . "',";
|
||||
}
|
||||
$sql = substr($sql, 0, -1); // strip off last comma
|
||||
|
||||
|
Reference in New Issue
Block a user