Hello, I am using cakePHP 1.3 and I cannot restore the last inserted row id. I really use $ this-> Model-> id to restore the last inserted id, but I cannot get the id. When you tried to check what the return type is, it says like bool (false), which means nothing is returned.
Here I load another model into another controller, so will this be a problem? But even if I download, I get nothing !!
$this->loadModel('Contact'); $this->Contact->query("insert into contacts(tblContact_firstName,tblContact_lastName,tblContact_company,tblContact_department,tblContact_address,tblContact_country,tblContact_city,tblContact_state,tblContact_zipcode,tblContact_phone1,tblContact_email1) values('$sanitizedFormData[fname]','$sanitizedFormData[lname]','','$sanitizedFormData[company]','$sanitizedFormData[address]','$sanitizedFormData[country]','$sanitizedFormData[city]','$sanitizedFormData[state]','$sanitizedFormData[zip]','$sanitizedFormData[phone]','$sanitizedFormData[email]');"); $this->loadModel('Contact'); $contactId = $this->Contact->id;
And when I printed the $ this-> Contact array recursively, I found that the id value is empty. Therefore, this explains why I was getting an empty value.
Now, given my situation, how do I get the last inserted identifier specific to contacting the controller?