Welcome Guest, Not a member yet? Register   Sign In
Update query is altered by safari???
#11

[eluser]TheFuzzy0ne[/eluser]
My bad. I forgot to pass an array. I've corrected the code above. Please try it again.
#12

[eluser]bobbob[/eluser]
I am now getting a strange problem with your line of code.

$this->db->update('members', array('preferred', $newdata);
or this:
$this->db->update('members',array('preferred' => $newdata);

My editoe doesn't like it and when I run it the parser claims there is:

Parse error: syntax error, unexpected ';' in

line 154 which is that line.
My eyes don't see the semicolon which shouldn't be there.
#13

[eluser]TheFuzzy0ne[/eluser]
Gah! I was missing a bracket. I've edited it again.
#14

[eluser]bobbob[/eluser]
Thanks TheFuzzyOne.
When I changed the validation to:
$this->form_validation->set_rules('preferred','preferred', 'required|trim|xss_clean');

it worked. There was a => between the preferred.

So that is great but I have another query which has many posts in it. This one was just one field to be updated. I like that i can just enter $_POST instead of set this as this etc for each item.
Is there a way to do that with active record?
#15

[eluser]TheFuzzy0ne[/eluser]
[quote author="bobbob" date="1234483277"]Thanks TheFuzzyOne.
When I changed the validation to:
$this->form_validation->set_rules('preferred','preferred', 'required|trim|xss_clean');

it worked. There was a => between the preferred.[/quote]

Sorry about that. I must have edited the wrong part

[quote author="bobbob" date="1234483277"]
So that is great but I have another query which has many posts in it. This one was just one field to be updated. I like that i can just enter $_POST instead of set this as this etc for each item.
Is there a way to do that with active record?[/quote]

Uhm... Did you miss the part where inserting the $_POST array into your database was breaking your application?

The way you had it originally would have worked, but you were getting an extra field from somewhere. That's why you need to sanitise your data. You should never trust any data coming from someone's browser. Likewise, you should never implement something you know to be security risk, or something that is likely to break your application, just to save a few lines of code, it's just not worth the risk.
#16

[eluser]bobbob[/eluser]
Thanks TheFuzzyOne

Very helpful

I will manage from here I think.
CI is great!
#17

[eluser]TheFuzzy0ne[/eluser]
I totally agree. CI is CI-exy (the latest edition to my vocabulary).




Theme © iAndrew 2016 - Forum software by © MyBB