On Wed, 2004-02-04 at 00:32, John Taylor-Johnston wrote: > I cannot declare $temp = $mydata->district; outside while ($mydata so ... ? > I'm missing something in my logic. That's why I asked. > It wouldn't make sense to declare this twice: > while ($mydata = mysql_fetch_object($myquery))
You could set the flag to null outside the loop, then check at the top of your loop to see if the flag and district differ. If so set the flag, echo what you need, and move on. The first time the loop runs the flag will differ and you will set it to the first vale of district as well as echo your district header, afterwords things will continue as expected. If you do not want to print out the district info the first time the loop runs then you can set $mydata outside the loop, initialize the flag variable, then use a do..while[1] loop to process the rest of your data. -Adam [1] http://us2.php.net/manual/en/control-structures.do.while.php -- Adam Bregenzer [EMAIL PROTECTED] http://adam.bregenzer.net/ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php