CodeIgniter Forums
Update query is altered by safari??? - 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: Update query is altered by safari??? (/showthread.php?tid=15698)

Pages: 1 2


Update query is altered by safari??? - El Forum - 02-12-2009

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


Update query is altered by safari??? - El Forum - 02-12-2009

[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.


Update query is altered by safari??? - El Forum - 02-12-2009

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


Update query is altered by safari??? - El Forum - 02-12-2009

[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?


Update query is altered by safari??? - El Forum - 02-12-2009

[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.


Update query is altered by safari??? - El Forum - 02-12-2009

[eluser]bobbob[/eluser]
Thanks TheFuzzyOne

Very helpful

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


Update query is altered by safari??? - El Forum - 02-12-2009

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