CodeIgniter Forums
[SOLVED] can't save transaction without details - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21)
+--- Thread: [SOLVED] can't save transaction without details (/showthread.php?tid=27165)

Pages: 1 2 3 4 5 6 7 8 9 10 11


[SOLVED] can't save transaction without details - El Forum - 02-14-2010

[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);



[SOLVED] can't save transaction without details - El Forum - 02-14-2010

[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.


[SOLVED] can't save transaction without details - El Forum - 02-14-2010

[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.


[SOLVED] can't save transaction without details - El Forum - 02-15-2010

[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()...


[SOLVED] can't save transaction without details - El Forum - 02-15-2010

[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;



[SOLVED] can't save transaction without details - El Forum - 02-15-2010

[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);
}
}


[SOLVED] can't save transaction without details - El Forum - 02-15-2010

[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;.


[SOLVED] can't save transaction without details - El Forum - 02-15-2010

[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...


[SOLVED] can't save transaction without details - El Forum - 03-03-2010

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

regards,
kahtrina