• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
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


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.