I have a function which reads a file from the HDD (works), retrieves
information from the file (works), and then writes this information to
the database(works).
Now my problem comes in when I try loop the function to do the above
with multiple files. Everything works except when I query the
database the fields haven't been updated from the previous save.
example
foreach($file_list as $file) {
//read file contents
//search to see if record exists
$user_id = $this->User->query("SELECT id FROM users WHERE
emailaddress = '[EMAIL PROTECTED]'");
//if record does not exist write record to db
$this->User->query("INSERT INTO users (emailaddress) VALUES
('[EMAIL PROTECTED]')");
//get last record inserted
$temp = $this->User->query("SELECT last_insert_id()");
}
On the first loop everything works 100%.
On the second loop even though the email address has been inserted and
is in the DB (supposedly) $user_id still returns empty as if nothing
is there. I put in the sleep command to see if maybe php is running
faster than the database is updating but this has no effect. What can
I do to make sure that all query processes have been completed before
it starts the next loop?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---