Re: Sql result loop problem !
| From: | Jason Stechschulte | Date: | Fri, 18 May 2001 16:35:01 +0000 |
| Subject: | Re: Sql result loop problem ! | ||
| References: | 1 2 3 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-9447@lists.php.net to get a copy of this message | ||
On Fri, May 18, 2001 at 04:32:51PM +0200, Keith Whyman wrote:
> while ($p = mysql_fetch_array($result1)) {
>
> $msg .= $p["s_bereich_name"];
> $msg .= $p["s_news_text"];
> $msg .= $p["s_users_real_name"];
I'm not sure if this is what you want, but something like this maybe??
<?php
while($p = mysql_fetch_array($result)) {
if($p["s_bereich_name"] != $oldBereichName) {
echo $p["s_bereich_name"]."<br>\n";
$oldBereichName = $p["s_bereich_name"];
}
echo $p["s_news_text"]." -
".$p["s_users_real_name"]."<br>\n";
}
?>
--
Jason Stechschulte
jpstech@unoh.edu
--
If I allowed "next $label" then I'd also have to allow "goto $label",
and I don't think you really want that... :-)
-- Larry Wall in <1991Mar11.230002.27271@jpl-devvax.jpl.nasa.gov>