Welcome Guest, Not a member yet? Register   Sign In
Most beautiful insertion with escape
#1

[eluser]Theis[/eluser]
Hi everyone.
Im new to CI, and I'm really loving how db->insert() can insert to the database by getting the data as a array, such as $_POST.

So my model looks simply like this:
Code:
function save(){
  $this->db->insert("page",$_POST);
  return $this->db->insert_id();
}

But I just that problem that i would like to escape all elements to avoid SQL-injection.
I know that there is some escape method in IC, but are there some easy way to escape $_POST in a way that i dont need do it for each variable in my array.

I just want my code clean and simple Smile
Hope you can help me. Thanks


Messages In This Thread
Most beautiful insertion with escape - by El Forum - 10-27-2012, 02:39 PM
Most beautiful insertion with escape - by El Forum - 10-27-2012, 02:42 PM
Most beautiful insertion with escape - by El Forum - 10-27-2012, 04:09 PM
Most beautiful insertion with escape - by El Forum - 10-28-2012, 06:02 AM
Most beautiful insertion with escape - by El Forum - 10-28-2012, 09:11 AM
Most beautiful insertion with escape - by El Forum - 10-28-2012, 09:44 AM



Theme © iAndrew 2016 - Forum software by © MyBB