php - Codeigniter update query not working with form -



php - Codeigniter update query not working with form -

hey guys i'm having problem running update query through form in codeigniter. there no error returned, query not update in database. should noted there's form on same page running insert query works fine.

view:

<?php $modify = array( 'id' => 'modify-form', 'class' => '' ); echo form_open('main/modify_idea', $modify); $ta_modify = array( 'id' => $row->id, 'name' => 'ta_modify', 'label' => 'ta_modify', 'placeholder' => $row->idea, 'method' => 'post' ); echo form_textarea($ta_modify); echo form_hidden('facebook_id', $session['id']); echo "<div id='button'>"; echo form_submit('submit', 'post'); echo "</div>"; echo form_close(); ?>

controller:

public function modify_idea() { $this->load->model('idea'); $this->idea->modify_idea(); redirect('main/members'); }

model:

public function modify_idea() { $data = array( 'id' => $this->input->post('id'), 'idea' => $this->input->post('ta_modify'), 'facebook_id' => $this->input->post('facebook_id') ); $query = $this->db->query("update thought set `idea` = ? `id` =?", array($data['idea'], $data['id'])); homecoming $query; }

i've utilized next resources still no luck: codeigniter mysql query not working

codeigniter mysql query not returning data, though there info returned!

http://www.tutorialspoint.com/mysql/mysql-update-query.htm http://ellislab.com/codeigniter/user-guide/database/active_record.html#delete

as always, help!

pass post info controller model

change controller code:

public function modify_idea() { $this->load->model('idea'); $data = array( 'id' => $this->input->post('id'), 'idea' => $this->input->post('ta_modify'), 'facebook_id' => $this->input->post('facebook_id') ); $this->idea->modify_idea($data); redirect('main/members'); }

in model this

public function modify_idea($data) { $query = $this->db->query("update thought set `idea` = ? `id` =?", array($data['idea'], $data['id'])); homecoming $query; }

php mysql codeigniter

Comments

Popular posts from this blog

javascript - mongodb won't find my schema method in nested container -

How do you set up a perforce server to work over the internet? -

ios - Lagging ScrollView with UIWebview inside -