Fix: add sql error
This commit is contained in:
parent
bc6fa60287
commit
7ee06a68bc
@ -85,6 +85,10 @@ if((isset($_POST['field']) && ! empty($_POST['field']))
|
||||
|
||||
$return['value'] = $value;
|
||||
}
|
||||
else
|
||||
{
|
||||
$return['error'] = $object->error;
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode($return);
|
||||
|
||||
@ -627,6 +627,8 @@ abstract class CommonObject
|
||||
function setValueFrom($table, $id, $field, $value)
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX.$table." SET ";
|
||||
$sql.= $field." = '".$this->db->escape($value)."'";
|
||||
@ -636,11 +638,13 @@ abstract class CommonObject
|
||||
$resql = $this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
dol_print_error($this->db);
|
||||
$this->error=$this->db->lasterror();
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user