Welcome Guest, Not a member yet? Register   Sign In
[SOLVED] can't save transaction without details

[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1266228457"]no, as I was saying, it is the code that is allowing it to work. You take it out and you will have to alter some other things to get your site to function again. I was just letting Xeroblast know the part of the code that is setting the $postConfig element.[/quote]

yes, i know the switch is working thanks for explaining.

EDIT:

@xeroblast

this line of code is my problem:

Code:
$item = $this->input->post("item");    
$data['item'] = $this->User->save_companydetail($dt,$item);

[eluser]theprodigy[/eluser]
Quote:
Quote: theprodigy - 14 February 2010 11:07 PM

no, as I was saying, it is the code that is allowing it to work. You take it out and you will have to alter some other things to get your site to function again. I was just letting Xeroblast know the part of the code that is setting the $postConfig element.

yes, i know the switch is working thanks for explaining.
That explanation was for Xeroblast. He had commented about it, so I was explaining it to him.

[eluser]maria clara[/eluser]
[quote author="theprodigy" date="1266231582"]
Quote:
Quote: theprodigy - 14 February 2010 11:07 PM

no, as I was saying, it is the code that is allowing it to work. You take it out and you will have to alter some other things to get your site to function again. I was just letting Xeroblast know the part of the code that is setting the $postConfig element.

yes, i know the switch is working thanks for explaining.
That explanation was for Xeroblast. He had commented about it, so I was explaining it to him.[/quote]

@theprodigy,

yes, now i understand. i know you were explaining it to him. thanks for the effort.

[eluser]xeroblast[/eluser]
try to view the data that will be save into the dbase before the $this->db->insert()... using var_dump() or print_r()...

[eluser]maria clara[/eluser]
[quote author="xeroblast" date="1266242201"]try to view the data that will be save into the dbase before the $this->db->insert()... using var_dump() or print_r()...[/quote]

when i initialize the variable $item to 1 or 2. it posts the data i added in the detail grid.

with this code:

Code:
case $crudConfig['create']:
                $c = "";
                $dt['company_code'] = $this->input->post('company_code');
                $this->User->getCompanyDetails($dt);
                /*$sec_exist = $this->User->getCompanyDetails($dt);
                
                if ($sec_exist)
                {
                    $c .= 'Company ID already exists.';
                    $data['action'] = 'exist';
                }
                else
                {*/
                $fields = array(
                         "company_code"
                        ,"company_name"
                        );
                
                foreach ($fields as $field)
                {if (isset($_POST[$field])) $dt[$field] = $this->input->post($field);}
    
                #print_r($_POST);
                $item = 2;    
                //$item = $this->input->post("item");
                $data['item'] = $this->User->save_companydetail($dt,$item);
                //}
                break;

[eluser]xeroblast[/eluser]
could you put the print_r() here:

function save_detail($id,$rows) //Query for saving the company details
{
$this->db->where('user_id', $id);
$this->db->delete('sec_companyaccess');

foreach ($rows as $row)
{
$rdata = explode('|', $row);

$data['user_id'] = $id;
$data['company_id'] = $rdata[3];

// print_r($data);

$this->db->insert('sec_companyaccess', $data);
}
}

[eluser]maria clara[/eluser]
[quote author="xeroblast" date="1266311338"]could you put the print_r() here:

function save_detail($id,$rows) //Query for saving the company details
{
$this->db->where('user_id', $id);
$this->db->delete('sec_companyaccess');

foreach ($rows as $row)
{
$rdata = explode('|', $row);

$data['user_id'] = $id;
$data['company_id'] = $rdata[3];

// print_r($data);

$this->db->insert('sec_companyaccess', $data);
}
}[/quote]

im not using that function anymore because it is for the flexigrid. i changed the flexigrid to jqgrid.

and here's the function im using now:

Code:
function save_companydetail($details,$id)
    {
        $this->db->trans_start();
        $this->db->insert('maint_company', $details);
        $DataId = $this->db->insert_id();
        $data['user_id'] = $id;
        $data['company_id'] = $DataId;    
        $this->db->insert('sec_companyaccess', $data);
        $this->db->trans_complete();
    }

it is adding now when i initialize $item=2;.

[eluser]xeroblast[/eluser]
put the var_dump() or print_r() here:

function save_companydetail($details,$id)
{
$this->db->trans_start();
$this->db->insert('maint_company', $details);
$DataId = $this->db->insert_id();
$data['user_id'] = $id;
$data['company_id'] = $DataId;

// print_r($data); // if there are data on this variable.

$this->db->insert('sec_companyaccess', $data);
$this->db->trans_complete();
}

also try to view all variables used if there are entries on it...

[eluser]maria clara[/eluser]
already solved this one. thanks for the replies. :-)

regards,
kahtrina




Theme © iAndrew 2016 - Forum software by © MyBB