Re: [PHP3] Memory Issues

From: Date: Mon, 28 Dec 1998 22:55:45 +0000
Subject: Re: [PHP3] Memory Issues
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-3149@lists.php.net to get a copy of this message
Do you have any pages in which there are MySQL queries inside loops? How many rows do you usually get in one query? Zeev At 15:40 28/12/98 -0500, Vincent Stoessel wrote: >Here is an example code of my web pages. >Could this have been done more efficiently. >Note: I cut out all the html in between the php >tags. Short tags enabled by default memory limit >is not enabled. > > ><? >mysql_connect("database","",'') >or die( "Unable to connect to SQL server"); >mysql_select_db( "xaymaca") or die( "Unable to select database"); >$result = mysql_query( "select headline, suid from edittool1 >where >section = 'news' and reveal= 'show' >order by suid desc >limit 5"); >?> ><? > >while ($row = mysql_fetch_row($result)) { > > >echo "<p><a href=newshead.php3?suid=" .$row[1] .">" .$row[0] >."</a>"; >} > >?> ><? >$result = mysql_query( "select xaymaca.edittool1.headline, >xaymaca.edittool1.story_txt, xaymaca.edittool1.tease, >hitlist.images.url ,hitlist.images.caption >from xaymaca.edittool1 >LEFT JOIN hitlist.images >USING(iuid) >where xaymaca.edittool1.suid = $suid >order by xaymaca.edittool1.suid desc limit 1"); > > > >while ($row = mysql_fetch_row($result)) { >//echo mysql_errno().": ".mysql_error()."<BR>"; >//Headline goes here > >echo "<h1>" .$row[0] ."</h1>"; > >?> > ><? >if (ereg("^http",$row[3])): >echo "<img src=" .$row[3] .">"; >endif; >?> ><? >echo $row[4]; >?> ><? >// The actual text of the story goes here >echo stripslashes(nl2br($row[1])); >} > > > > ?> > >-- >PHP 3 Mailing List http://www.php.net/ >To unsubscribe send an empty message to php3-unsubscribe@lists.php.net >To subscribe to the digest list: php3-digest-subscribe@lists.php.net >For help: php3-help@lists.php.net Archive: http://www.php.net/mailsearch.php3 >List administrator: zeev@zend.com > > > -- Zeev Suraski <zeev@zend.com> For a PGP public key, finger bourbon@netvision.net.il -- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe@lists.php.net For help: php-dev-help@lists.php.net

« previous php.dev (#3149) next »