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:
mchasteen
2015-02-16 10:19:09 -07:00
committed by laf
parent a1ef2e0f69
commit 357af32654

View File

@ -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