$v){ if($v != "#/noupdate/#"){$items[] = $k."=:".$k; $finalarr[$k] = str_replace("£", "£", $v);} } $items = (string)implode(",", $items); $DB->QuerySingle("INSERT INTO ".$tbl." SET ".$items, $finalarr); if(count($DB->error) < 1) return true; else return false; } // Build and run update query from array // Returns true on success, false on failure public static function UpdateQueryFromArray($tbl, $arr, $where, $id){ global $DB; $items = array(); $finalarr = array(); foreach($arr as $k => $v){ if($v != "#/noupdate/#"){ $items[] = $k."=:".$k; $finalarr[$k] = str_replace("£", "£", $v); } } $items = (string)implode(",", $items); $finalarr["id"] = $id; $DB->QuerySingle("UPDATE ".$tbl." SET ".$items." ".$where, $finalarr); if(count($DB->error) < 1) return true; else return false; } }