On 05:11 PM 5/10/2002 -0500, Shaun Thomas wrote:
>This could use a few tweaks.
Ok I got it now... This exhibits the behaviour I was looking for, and,
thanks to you, is much easier to read and maintain! :)))
Thanks, Shaun!
Glenn
$sPrevCompany = $sColor = '';
while ($aRow = mssql_fetch_row($stmt))
{
$sCompanyName = $aRow[$companyname];
/* If our previous company name is the same as this one, don't print
the company name, but print the data. */
if ($sPrevCompany !== $sCompanyName)
{
$sColor = ($sColor == 'FF') ? '00' : 'FF';
$sPrevCompany = $sCompanyName;
} else {
$sCompanyName = ' ';
}
/* We're past our if statement, so save the previous company for
next time. */
print (
"<TR BGCOLOR=#FFFF$sColor>\n".
"\t<TD>$aRow[0]</TD>\n".
"\t<TD>$aRow[1]</TD>\n".
"\t<TD>$sCompanyName</TD>\n".
"\t<TD>$aRow[2]</TD>\n".
"\t<TD>$aRow[4]</TD>\n".
"\t<TD>$aRow[5]</TD>\n".
"\t<TD>$aRow[6]</TD>\n".
"\t<TD>$aRow[7]</TD>\n".
"</TR>\n");
}
print ("</TABLE>");
---
Glenn E. Sieb, System Administrator
Lumeta Corp. mailto:[EMAIL PROTECTED]
+1 732 357-3514 (V)
+1 732 564-0731 (Fax)
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php