Welcome Guest, Not a member yet? Register   Sign In
Multiple forms to one MySql table
#1

[eluser]Todlerone[/eluser]
Hello all and TY in advance. I have two forms that add to the same MySql table. In my model I have tried to parse the data depending on which form they came from. When I try it I get a:

A Database Error Occurred
You must use the "set" method to update an entry.

I'm trying to insert new data, not alter existing data.

Code:
<?php
   class Patients extends Model {
    function Patients(){
            parent::Model();
    }
    function add_schedule($ptID){
           $da =array();
        if ($this->input->post('sche_CDate') == TRUE){
            $da = array(
                'demo_NumID' => $ptID,
                'sche_date' =>$this->input->post('sche_CDate'),
                'sche_type' => 'con',
                'sche_location' => 'jcc');
        }
        if ($this->input->post('sche_RDate') == TRUE){
            $da = array(
                'demo_NumID' => $ptID,
                'sche_date' =>$this->input->post('sche_RDate'),
                'sche_type' => 'ref',
                'sche_location' => 'jcc');    
        }
        if ($this->input->post('fromform') == 'yes'){
            $da = array(
                'demo_NumID' => $ptID,
                'sche_date' => $this->input->post('sche_date'),
                'sche_type' => $this->input->post('sche_type'),
                'sche_location' => $this->input->post('sche_location'));
        }
        $this->db->insert('schedule', $da);
        }
}

TY


Messages In This Thread
Multiple forms to one MySql table - by El Forum - 11-23-2010, 12:40 PM
Multiple forms to one MySql table - by El Forum - 11-23-2010, 01:32 PM
Multiple forms to one MySql table - by El Forum - 11-23-2010, 01:42 PM
Multiple forms to one MySql table - by El Forum - 11-23-2010, 01:52 PM



Theme © iAndrew 2016 - Forum software by © MyBB