[PHP-DEV] Re: [PHP3] Memory Issues From: Zeev Suraski (zeev <email protected>)
Date: 12/28/98

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 <email protected>
>To subscribe to the digest list: php3-digest-subscribe <email protected>
>For help: php3-help <email protected> Archive:
http://www.php.net/mailsearch.php3
>List administrator: zeev <email protected>
>
>
>

--
Zeev Suraski   <zeev <email protected>>
For a PGP public key, finger bourbon <email protected>

-- PHP Development Mailing List http://www.php.net/ To unsubscribe send an empty message to php-dev-unsubscribe <email protected> For help: php-dev-help <email protected>