get data from query before while loop

From: Date: Mon, 11 Mar 2002 04:43:27 +0000
Subject: get data from query before while loop
Groups: php.general 
Request: Send a blank email to php-general+get-87953@lists.php.net to get a copy of this message
I have a mysql query that I need to echo a variable from "once" before I go into the while loop which would list the entire contents of the array. The field shown once will not be displayed in the while looped contents. So theoretically, something like this: $result = mysql_query("SELECT h.title, a.agentname, a.agenturl, IF(h.status='Sold',1,0) AS is_sold FROM homes h, agents a WHERE h.owner=a.id AND a.id=$aid ORDER BY is_sold ASC"); if ($is_sold=="1") { echo $agentname." ".$agenturl; } while ($row=mysql_fetch_array($result)) { extract($row); echo $title."<br>"; } Currently, I have everything in the while loop which prints things out more than what I'd like. Is there a way that I can get around this problem? Any suggestions are greatly appreciated thanks. :) __________________ Jason Dulberg Extreme MTB http://extreme.nas.net

« previous php.general (#87953) next »