Which is more efficient?
a) a sql loop where everything is displayed/formatted using echo stmts,
like this:
$result = mysql_query("SELECT * FROM news WHERE active=1");
while ($row = mysql_fetch_object($result)) {
echo "<TR><TD>$row->title </TD></TR>";
}
mysql_free_result($result);
?>
OR
b) a sql loop where you break in and out of php tags as needed:
<?php
$result = mysql_query("SELECT * FROM news WHERE active=1");
while ($row = mysql_fetch_object($result)) {
?>
<TR><TD>
<?php echo "$row->title"; ?>
</TD></TR>
<?php
}
mysql_free_result($result);
?>
Obviously, these are really simplified examples. Typically the html code
gets much more complicated.
Peter
- - - - - - - - - - - - - - - - - - - - -
Fourth Realm Solutions
[EMAIL PROTECTED]
http://www.fourthrealm.com
Tel: 519-739-1652
- - - - - - - - - - - - - - - - - - - - -
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php