[SOLVED] update query with multiple tables - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: [SOLVED] update query with multiple tables (/showthread.php?tid=26409) |
[SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]maria clara[/eluser] hi to all, im currently fixing this update for a table. when i am editing a data in a row it shows an undefined variables for other fields because i have joined other tables. im using this script: Code: case $crudConfig['update']: but this script is just applicable for 1 table only without a joined one. that's why im having an undefined variable error message in my console. what query do i need for a joined table?? the error pertains to this script: Code: foreach($crudColumns as $key => $value){ $updateArray[$key] = $value.'='.$crudColumnValues[$key]; }; hope you can help me.. thanks in advance, maria [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]flaky[/eluser] a fast example Code: $this->db->where('column', $data['column_name']); [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]maria clara[/eluser] this are the script of tables i joined Code: $this->db->join('maint_customers erp_b','ar_sales.client_id=b.cust_id','left'); these are joined query..my script for updating is not working because it is applicable for one table query only. [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]flaky[/eluser] do you want to update one table or 2 or more tables [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]maria clara[/eluser] yes i want to update a multiple tables in a jqgrid because in a transaction, there are fields that are from other tables. so i join them as you can see. the fields in the other tables should be updated also so that there will be no error in my console. how to make a query for a joined tables using set function? [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]flaky[/eluser] Code: UPDATE a Code: $this->db->set('a.firstname', 'Pekka'); hope it helps [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]maria clara[/eluser] i used $CrudColumns as an array for the fields. all of the fields are there including the fields in other tables. like what i have shown you.i used this for the tables that are joined Code: $crudTableName = "'erp_ar_sales','erp_b','erp_c','erp_d','erp_e','k'"; this was the error shown in my console Code: <p>Severity: Notice</p> [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]flaky[/eluser] would you mind putting the complete function code here [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]maria clara[/eluser] this is the pull code: Code: function post2() [SOLVED] update query with multiple tables - El Forum - 01-13-2010 [eluser]flaky[/eluser] where are you taking Code: $updateArray from? EDIT basically you need to declare it before using it |