0

My website has been moved on a new server, everything is working well, but I receive UPDATE and INSERT MDB2 Error: syntax error

Here is my code:

$sql = "UPDATE {$db_conf['db_name']}.{$this->db_table} SET ";
    foreach($attr as $key => $value)
        {
        if(is_numeric($value)) 
            {$sql .= "{$key} = {$value}, ";}
        else 
            {
            $value=cleanupString($value);
            if("" == $value) 
                {$sql .= "{$key} = NULL, ";}
            else 
                {$sql .= "{$key} = \"{$value}\", ";}
            }
        }
    $sql = substr($sql,'',-2); 
    $sql .= " WHERE cop_id = {$existing_id}"; 

    $result = $handle_db->query($sql);
    if(PEAR::isError($result))
        {die("CoP::commit | UPDATE ".$existing_id." | ".$result->getMessage());}
    return true;
    }

Any help ?

Xavi López
  • 27,550
  • 11
  • 97
  • 161
jbfelix
  • 1
  • 1
  • This question might be related to [PHP List based on Form Selection: MDB2 Error: syntax error](http://stackoverflow.com/q/15536365/851811) (was originally posted as an answer there). – Xavi López May 15 '14 at 09:19
  • Can you echo an actual value for $sql when it is being sent to the database, please? It might help in the identification of the problem. – CodeTwice May 15 '14 at 09:49

0 Answers0