[BNM] php and persistence with (oracle) databases

Jason Bailey j.bailey at sussex.ac.uk
Fri May 11 13:13:03 BST 2007


Hi Paul,
Thanks I think I've got a few ideas now and can see the problems. I forgot 
to mention the middle bit which uploads the file to the filespace before 
inserting into the database; this could be where the problem lies i.e. 
nothing to insert and not adequate checks.

> If the user resubmits the request, after the first has been received (but
> before they have had any feedback) then you could have the script running
> twice for the same uploaded document (one a bit behind the other), how
> this is handled is down to how you are handling sessions in PHP; how you
> are using keys in the DB and how you are handling errors.

Yes this looks to be the case. I created a large document (small enough to 
be uploaded, though) and kept hitting the submit button before refresh 
occurred. The code did indeed run several inserts- a bit obvious I know!


> The general model that I would use would be to 'insert' an empty record
> with a status of 'in progress' with a key unique to the email request -
> if this fails (already exists) then this is a resubmission of something

That really helps, I think the answer is to create an empty record and use 
update rather than insert.

Thanks for this.

Jason


-- 
Jason Bailey
IT Services
University of Sussex
http://www.sussex.ac.uk/USIS/phone/details.php?id=17011



More information about the BNMlist mailing list. Powered by Wessex Networks