• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Saving data to MYSQL

#2
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

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.