Welcome Guest, Not a member yet? Register   Sign In
MySQL Inserting twice and not sure why
#1

[eluser]bapobap[/eluser]
Hi everyone,

In my controller I load my library, called main and call the start_page function:
Code:
$this->load->library('main');
echo $this->main->start_page(); // doesn't return anything

In the main library I have the start_page function, which is:
Code:
function start_page()
{
$obj =&get;_instance();
$sql = 'INSERT INTO `site_requests` (`id`, `request`, `referer`, `ip`, `xip`, `type`, `user_agent`, `date`) VALUES (NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);';
$obj->db->query($sql);
}

When I load the page, I have it print out the SQL query, which it does once but for some reason it inserts into the database twice.

Now I'm sure it's being a terrible programmer (I am trying!) but I don't know what it outputs it once but does the insert twice. Any ideas?


Messages In This Thread
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 10:33 AM
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 10:49 AM
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 11:57 AM
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 12:03 PM
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 12:08 PM
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 12:24 PM
MySQL Inserting twice and not sure why - by El Forum - 01-10-2008, 02:29 PM
MySQL Inserting twice and not sure why - by El Forum - 01-11-2008, 10:45 AM
MySQL Inserting twice and not sure why - by El Forum - 01-11-2008, 11:10 AM
MySQL Inserting twice and not sure why - by El Forum - 01-11-2008, 03:02 PM
MySQL Inserting twice and not sure why - by El Forum - 01-11-2008, 03:28 PM
MySQL Inserting twice and not sure why - by El Forum - 01-12-2008, 01:16 AM



Theme © iAndrew 2016 - Forum software by © MyBB