Welcome Guest, Not a member yet? Register   Sign In
Query Helper Functions v 1.7.2
#1

[eluser]petewulf[/eluser]
Hello there,

just found an annoying Bug with the db->update_string() method, which makes the function completely useless for me:

CI generates an incorrect Update string with PHP Warnings if you try to call the method with an empty field-array like

$this->db->update_string('tablename', array(),'id=1')

results in: UPDATE `tablename` SET WHERE id=1

CI should definitely handle user-input errors right, which is a very very basic thing of each application development, otherwise there is no need for helper functions like this because i can also write a function to implode without checking for empty variables/arrays in a one-liner.

I don't want to check for each array/variable for the correct format, i just want to write my update string like this:

public function update($id, $data){
$where = 'id="'.mysql_real_escape_string($id).'"';
if($sql = $this->db->update_string('tablename', $data, $where)){
if($this->db->query($sql)) return true;
else return false;
}
}


Regards,
Pete




Theme © iAndrew 2016 - Forum software by © MyBB