question about nested ifs and login
| From: | John A DAVIS | Date: | Fri, 23 Aug 2002 18:18:48 +0000 |
| Subject: | question about nested ifs and login | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-21326@lists.php.net to get a copy of this message | ||
I'm trying to only display only one row for any Analyte Groups that are
"OC","IOC" and have the same date. My logic is choking. I can't seem to
assign variables inside the if statements and on top of that they are nested inside a do loop!
I'm trying to mosey along and if the date and group are the same, I only display those rows
once and skip the rest until date or group values change.
$data=odbc_do($connectionSDWIS, "SELECT ActionType, ViolationName, AnalyteName, AnalyteGroup
FROM EnforcementsNew WHERE PWSID ='$pwsno' ORDER BY EnforcementDate DESC ");
echo "<br>";
echo "<table width=80%>\n";
echo "<th bgcolor=lightblue align=center colspan=4><b>Current Enforcement
Data</b></th>";
echo "<tr><td><b>Enforce Date</b></td><td><b>Type of
Action</b></td><td><b>Reason For
Action</b></td><td><b>Rule</b></td><td><b>Group</b></td>";
echo "</tr>";
/* fill table with data */
odbc_fetch_row($data);
do
{
echo "<tr>";
$thisgroup == trim(odbc_result($data,"AnalyteGroup"));
if($thisgroup == "OC")
{
if ($group = Trim(odbc_result($data,"AnalyteGroup")) AND
$date=Trim(odbc_result($data,"EnforcementDate")))
{
$doecho =1;
}
else
{
$doecho = 0;
}
}
if ($doecho ==1)
{
echo "<td nowrap>".odbc_result($data,1)."</td>"."<td
nowrap>".odbc_result($data,2)."</td>".odbc_result($data,3)."<td
nowrap>Analyte
Group: ".odbc_result($data,5)."<td>".odbc_result($data,5)."</td>";
}
else
{
$fields=odbc_num_fields($data);
for($i=1 ; $i<=$fields ; $i++)
echo "<td nowrap>".odbc_result($data,$i)."</td>";
}
echo "</tr>\n";
$group = Trim(odbc_result($data,"AnalyteGroup"));
$date = Trim(odbc_result($data,"EnforcementDate"));
} while(odbc_fetch_row($data));
echo "</table>";