CodeIgniter Forums
confirming successful update - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: confirming successful update (/showthread.php?tid=12859)



confirming successful update - El Forum - 11-02-2008

[eluser]Fenix[/eluser]
is there an easy way to check if a query has run successfully?
i'd like the update fucntions in my model to return true/false if they did/didn't succeed.
is this even necessary?
any ideas?

thanks


confirming successful update - El Forum - 11-02-2008

[eluser]freshface[/eluser]
$response = $this->db-> ....

if($response ...


confirming successful update - El Forum - 11-02-2008

[eluser]OES[/eluser]
In Model just place your query in an if like.


Model
Code:
if(!$this->db->update('table_name', $data)):
  return FALSE;
endif;

Controller
Code:
if(!$this->model_name->update_function($data)):
  // it failed
else:
  // It passed do something else.
endif;

Hope this helps

Good Luck