I'm using apache, php, mysql and code igniter and I have a database set up. In the database I have two columns that both need to be unique in combo: latitude and longitude.
So I set up the database using this call:
alter table pano_raw add unique index(lat, lng)
Now when I insert values into the two columns (lat and lng) if the value is the same, the database should reject the write correct?
function addNewSet($data)
{
$this->db->insert('sets', $data);
}
This function should return a true or false, depending on the success of the read or write correct?
So now how so I alter it so that when it will return the row_id of the inserted record or return FALSE? If the write worked, I need the row_id, if it didn't I need FALSE so I can alter the code that called this function.
Would this work? I don't think so. Ideas?
function addNewSet($data)
{
$this->db->insert('sets', $data);
return $this->db->insert_id();
}