Welcome Guest, Not a member yet? Register   Sign In
Database insert randomly returns false -- $this->db->insert
#1

[eluser]blasto333[/eluser]
I know there is not that much context, but I am been banging my head against the wall on this one for some time now...any ideas?

Code:
function save(&$person_data, &$employee_data,&$permission_data,$employee_id=false)
{
    $success=false;
    
    //Run these queries as a transaction, we want to make sure we do all or nothing
    $this->db->trans_start();
        
    if(parent::save($person_data,$employee_id))
    {
        if (!$employee_id or !$this->exists($employee_id))
        {
            $employee_data['person_id'] = $person_data['person_id'];
            $success = $this->db->insert('employees',$employee_data);
        }
        else
        {
#2

[eluser]jedd[/eluser]
[quote author="blasto333" date="1259734003"]
I know there is not that much context, but I am been banging my head against the wall on this one for some time now...any ideas?
[/quote]

What does the [url="/user_guide/general/profiling.html"]Profiler[/url] reveal about the failing cases?

Code:
function save(&$person_data, &$employee_data,&$permission_data,$employee_id=false)

{blink!}
#4

[eluser]jedd[/eluser]
Time to crank up your database logging!

phppos_employees.person.id isn't UNIQUE or something silly like that?

Probably unrelated but person_id seems to go from 1 to -1 through the course of your transaction. I'm guessing -1 is your test account.




Theme © iAndrew 2016 - Forum software by © MyBB