Welcome Guest, Not a member yet? Register   Sign In
Simple question

Hi everyone, this is my first time using CI for a project, I have been reading the user guide and experimented with the basics. Now I am updating one of my projects to run on the CI framework.

At the start of my controller script I just want to clean all the post data and make it ready for inserting into a database. So in my old scripts I used this code:

// For each posted valuse assign the name and value, and make it safe for insterting into a database
foreach ($_POST as $key => $value) {
$$key = stripslashes(mysql_real_escape_string($value));

Is there a better way of doing this in CI?

Thanks for the help.

[eluser]Thorpe Obazee[/eluser]
you won't need to use mysql_real_escape_string(). You can either choose to use AR or Query Bindings to automatically 'clean'. Another alternative way is to use $this->db->escape()

Theme © iAndrew 2016 - Forum software by © MyBB