CodeIgniter Forums

Full Version: Simple query insert duplicates
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

Hey everybody,

Do you have any idea why runs this query twice?

function log($name, $message, $type = 'user')
        $entry = array(
            'name' => $name,
            'message' => $message,
            'type' => $type,
            'ip' => $this->input->ip_address(),
            'logdate' => date('Y-m-d H:i:s')

        $this->db->insert('watchdog', $entry);

test it
function test()
        $this->watchdog_model->log('system', $this->lang->line('w_unlock_users'), 'maintance');

It insert two rows in the database, and I really don't know why?

Thx for your help!

El Forum

That is all your code? maybe you are calling log method in another place or something like that?


El Forum

Or have a redirect reloading the page, or a missing image that causes a rewrite request to index.php...

Set your log_threshold to 4, and check your application log. You should see multiple requests there if that is causing it.