Welcome Guest, Not a member yet? Register   Sign In
Process of prepping
#1

[eluser]williamparry[/eluser]
Hi,

I've been reading the documentation about "prepping data" and I am wondering if someone could give me a practical example of doing this with a database?

If I have:

Code:
$rules['firstName']        = "trim|required";

How can I insert the trimmed data into the database? What variable do I use?
#2

[eluser]Pascal Kriete[/eluser]
Once the validation runs the post data is overwritten with the new values.

So in this case just do
Code:
$this->input->post('firstName');
#3

[eluser]williamparry[/eluser]
If I do that, it ignores my rules. I've tried it with passwords and md5 and it just ignored converting it to md5.
#4

[eluser]Pascal Kriete[/eluser]
Make sure you run the validation first:
Code:
if ($this->validation->run() == FALSE)
{
    //Changed, but validation error
}
else
{
    //Insert them into db here
}

EDIT: Also make sure you called $this->validation->set_rules($rules);




Theme © iAndrew 2016 - Forum software by © MyBB