I have now set the sleep to 10 seconds and it is still executing the lower code before finishing doing the search of the database it must be sleeping during the search and so the sleep command has no effect I need to make it wait before executing the array sorting any workaround ?
-- www.phpexpert.org/truefaith.htm "True Faith is not just when you believe in God and yourself, it is when others begin to believe in you as well" - Damian John Paul Brown 2004 "Jason Sheets" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Take a look at the set_time_limit function, it will allow you to set the maximum execution time to a greater value, note that when you call the function it sets the max time and resets the timer so if you set it to 100 seconds 20 seconds into the script the script will run for a maximum of 120 seconds. http://us3.php.net/manual/en/function.set-time-limit.php Jason -----Original Message----- From: David Risner [mailto:[EMAIL PROTECTED] Sent: Monday, April 12, 2004 9:42 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] how do I make a script wait ? There is a default maximum run time for scripts of 30 seconds (it is max_execution_time in the php.ini file), so unless you have changed this, you might be running into the maximum run time. -- David Risner On Tue, 13 Apr 2004 04:06:51 +0100, "Damian Brown" <[EMAIL PROTECTED]> said: > The code is shown below > there is now a delay before the page is displayed of 50 secs it must > be hitting the sleep command as it searches, and so stops searching > the database table is there any workaround ? > > echo "Your Search Results are as follows<p>"; ?> <table width="100%" > border="2" cellspacing="0" cellpadding="1"> > <tr bgcolor="#00A5C6"> > <td>Title</td> > <td>URL</td> > <td>Description</td> > <td>for Keyword</td> > </tr> > <?php > $result=mysql_query("SELECT * FROM `searchdata` WHERE 1 AND `keyword` = " > . > "'$thissearchterm'" ); > $key=1 ; > while ($row=mysql_fetch_row($result)){ ?> <?php mysql_query("INSERT > INTO searchsorting (username,bid) VALUES ( ' > $row[5] ' , ' $row[6] ' )"); > $a = array( $key => $row[6] ); > $key=$key + 1 ; ?> > > <?php > } ; //end of while loop > ?> > > <?php > sleep (50) ; > function cmp ($a, $b) { > if ($a == $b) return 0; > return ($a > $b) ? -1 : 1; > } > > // $a = array (0.10, 0.30, 5, 6, 1); > > usort ($a, cmp); > echo "Bid Prices and Positions<br>" ; > while (list ($key, $value) = each ($a)) { > echo " Position $key: £$value > "; > > } > echo " <a href=http://www.phpexpert.org/ppcsearch/>Become a Bidder</a> > "; ?> > > > </table> > > -- > www.phpexpert.org/truefaith.htm > "True Faith is not just when you believe in God and yourself, it is > when others begin to believe in you as well" - Damian John Paul Brown > 2004 "Ryan A" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > Hey, > > Use the sleep() function. > > > > Cheers, > > -Ryan > > > > On 4/13/2004 4:42:56 AM, Damian Brown ([EMAIL PROTECTED]) wrote: > > > I am writing a script that searches through a database table, and > > > then there is an array function below the searching, but the array > > > function gets executed before the database table searching > > > finishes and I want it to wait until the database has been > > > searched before executing the array code > > > > > > Thanks in Advance > > > > > > -- > > > www.phpexpert.org/truefaith.htm > > > "True Faith is not just when you believe in God and yourself, it > > > is when others begin to believe in you as well" > > > - Damian John Paul Brown 2004 > > > > > > -- > > > PHP General Mailing List (http://www.php.net/) To unsubscribe, > > > visit: http://www.php.net/unsub.php > > -- > PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: > http://www.php.net/unsub.php > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php