Welcome Guest, Not a member yet? Register   Sign In
Saving data to MYSQL
#2

(This post was last modified: 11-19-2019, 05:09 PM by InsiteFX.)

you need to save the record using an associated array.

PHP Code:
// Controller
public function savedata()
{
    /*load registration view form*/
    $this->load->view('insert');

    /*Check submit button */
    if($this->input->post('savePostcode'))
    {
    
$data = [
            'first_name' => $this->input->post('postCode'),
            'last_name'  => $this->input->post('delivery'),
        ];

        $this->Settings_model->saverecords($data);
        echo "Records Saved Successfully";
    }
}

// Model

/* Insert postcodes to table*/
public function saverecords($data)
{
    return $this-db->insert('Postcodes'$data);


SEECodeIgniter User Guide - Database Reference -> Query Builder Class
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
Saving data to MYSQL - by dmorgan20 - 11-19-2019, 10:25 AM
RE: Saving data to MYSQL - by InsiteFX - 11-19-2019, 05:06 PM



Theme © iAndrew 2016 - Forum software by © MyBB