Re: how do I make a script wait ?

From: Date: Tue, 13 Apr 2004 03:41:48 +0000
Subject: Re: how do I make a script wait ?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-183200@lists.php.net to get a copy of this message
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" <damian@phpexpert.org> 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" <ryan@coinpass.com> wrote in message > news:000301c42101$abc89630$f081aa51@l2zcaxu7emppqh... > > Hey, > > Use the sleep() function. > > > > Cheers, > > -Ryan > > > > On 4/13/2004 4:42:56 AM, Damian Brown (damian@phpexpert.org) 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 >

« previous php.general (#183200) next »