Welcome Guest, Not a member yet? Register   Sign In
Using $this->input->post in a SQL Query Update
#4

[eluser]Derek Jones[/eluser]
I personally like to create a new associative array of field names with values. It's cleaner in the code to me, and more explicit about what's being set to what, and encourages you to think about validation and security. Then simply:

Code:
$this->db->update('table_name', $data_array);

Let CI escape it for you. If you prefer manually written SQL, that's fine too, just make sure you use $this->db->escape() or $this->db->escape_str() as necessary. Either way, you'll need to either break out of the string to execute that, or do it before hand and set it to a variable.


Messages In This Thread
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 12:07 PM
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 12:12 PM
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 12:20 PM
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 12:41 PM
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 12:46 PM
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 01:02 PM
Using $this->input->post in a SQL Query Update - by El Forum - 07-18-2008, 01:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB