RE: [PHP] Can a script run twice?
| From: | tedd | Date: | Wed, 24 May 2006 17:02:20 +0000 |
| Subject: | RE: [PHP] Can a script run twice? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-236840@lists.php.net to get a copy of this message | ||
At 9:58 AM -0400 5/24/06, Jim Moseby wrote:
I didn't suggest using either. I just said check first before adding a duplicate record. However, using REPLACE rather than INSERT would probably be best. The MySQL manual states that REPLACE works exactly like INSERT except REPLACE either inserts, or deletes and inserts. So, it's still a "lookup/compare/write if" sequence, but it's an internal mysql operation, which should be quicker and less coding (i.e., more economical) than using php/mysql to do it. tedd -- ------------------------------------------------------------------------------------ http://sperling.com http://ancientstones.com http://earthstones.comApparently the problem isn't solvable by using tokens, sessions, locking, and such. So why not just check the dB to see if the current record has already been entered? If so, don't do it again. Isn't this a solution? Or is there something here that I'm not understanding?...or maybe do a 'REPLACE...' rather than an 'INSERT...'? That way the record is not entered into the database twice if it already exists. Might be a more economical way than doing a "lookup/compare/write if" sequence. JM