Hello Martin, Monday, August 8, 2005, 4:07:47 PM, you wrote: MvdB> Now here is the problem: when the user enters the page, and MvdB> directly refreshes the record is inserted twice.... Is is MvdB> possible that both requests are processed simulatiounsly by the MvdB> server (apache on linux)? And can I add something like a MvdB> critical section or semaphore to overcome this problem. What data type does the execute function return? You're doing a loose type comparison between $rows and zero (== rather than ===), because it's a loose comparison a number of different results could equal zero in this case. For example if execute() returned false your code would assume an insert is required, which might not be the case. If you're using MySQL then you may want to look at using a different method for checking / inserting this data. Rather than a SELECT followed by INSERT you could use an INSERT IGNORE which won't duplicate data if it already exists. Or possibly REPLACE INTO - depends how you need this to work (i.e. retain the oldest copy of the data, or keep the newest). Look in the MySQL manual for those two functions for more info. Best regards, Richard Davey -- http://www.launchcode.co.uk - PHP Development Services Zend Certified Engineer "I do not fear computers. I fear the lack of them." - Isaac Asimov -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php