let’s say I have “index.php” . It has a form that POSTS to “signup.php” and then redirects back to “index.php” .It invloes two database queriie ie insertion and deletion . Sp can I just use sleep for say sleep(2)in “Index.php” to let the queries get completed . I have discovered that I don’t even have to leave the page for doing this !
It just refreshes by itself ( bocz of the redirect commane in the processing php file ? ) .
If I have many users using the same file on website at the same time , will this help or backfire ? Thankx!
You don’t have to sleep. The database operations will block until they’re complete; the script will not continue executing until the database operations are finished.
Forcing your script to sleep for two seconds will backfire terribly, causing every request to sit there doing nothing for two seconds. This will cripple a medium- to high-traffic site.