Dear friends, below code is displayed left to right for instance:
Site Code = 31700020401; TYPE = Volume; AADT = NA etc.
We have a situation where one site code could be associated with 1 or more filenames.
Currently, the way it displays now is site code is redundant.
Please see the examples below
SITE CODE 31700020401 TYPE Volume
AADT NA DATE 5/20/2002
LOCATION Northside Drive DISTANCE 1
REF LOCATION Old Powers Ferry Road DIRECTION S
FILE NAME Riverview Rd EB 5-02.pdf
Close
SITE CODE 31700020401 TYPE Volume
AADT NA DATE 5/20/2002
LOCATION Northside Drive DISTANCE
REF LOCATION Old Powers Ferry Road DIRECTION N
FILE NAME Northside Dr NB 5-02.pdf
Close
SITE CODE 31700020401 TYPE Volume
AADT NA DATE 5/20/2002
LOCATION Northside Drive DISTANCE
REF LOCATION Old Powers Ferry Road DIRECTION S
FILE NAME Northside Dr SB 5-02.pdf
Close
SITE CODE 31700020401 TYPE Volume
AADT NA DATE 5/20/2002
LOCATION Northside Drive DISTANCE
REF LOCATION Old Powers Ferry Road DIRECTION E
FILE NAME Old Powers Ferry Rd WB 5-02.pdf
Close
If you look at the above , you can see the site code is displayed 4 times even though it is the same site code but we don't want this type of display.
We would prefer one site code with all files together like below:
SITE CODE 31700020401 TYPE Volume
AADT NA DATE 5/20/2002
LOCATION Northside Drive DISTANCE
REF LOCATION Old Powers Ferry Road DIRECTION E
FILE NAME Riverview Rd EB 5-02.pdf
Northside Dr NB 5-02.pdf
Old Powers Ferry Rd WB 5-02.pdf
Northside Dr SB 5-02.pdf
I have done something similar with asp and it works but I am extremely new to php and I am having problems duplicating the same here.
Here is the code I have so far.
Any help would be greatly appreciated.
[COLOR=BLUE]
<?php
$conn = odbc_connect("counts", "", "") or die(odbc_error());
$sql = "SELECT
fctrafic.site_code,
fctrafic.location,
fctrafic.location2,
fctrafic.distance,
fctrafic.direction,
trafficcountsFiles.fdate,
trafficcountsFiles.types,
trafficcountsFiles.aadt,
trafficcountsFiles.filename
FROM trafficcountsFiles,fctrafic
WHERE fctrafic.site_code = trafficcountsFiles.sitecode
AND fctrafic.site_code = '".$_GET["site_Code"]."'";
$results = odbc_exec($conn,$sql);
for($count=0; $row = odbc_fetch_array($results); $count++)
{
//Start with a variable ...
$sLastSiteCode = '';
//As we loop through, echoing the rows ...
if ($sLastSiteCode == $row['site_code'])
{
$row['site_code'] = ' ';
}
else
{
// End the table and print new headers
}
$sLastSiteCode = $row['site_code'];
// Print the row details as normal.
?>
<html>
<head>
<title>Trafic Counts</title>
<link rel="stylesheet" type="text/css" href="styles.css">
</head>
<body bgcolor="#6270B5">
<div align="center">
<table cellpadding="2" cellspacing="2">
<tr>
<td class="header"><font size="-3">SITE CODE</font></td>
<td class="name"><font size="-3"><?=$row["site_code"]?></font></td>
<td class="header"><font size="-3"> TYPE</font></td>
<td class="name"><font size="-3"><?=$row["types"]?></font></td>
</tr>
<tr>
<td class="header"><font size="-3">AADT</font></td>
<td class="name"><font size="-3"><?=$row["aadt"]?></font></td>
<td class="header"><font size="-3">DATE</font></td>
<td class="name"><font size="-3"><?=$row["fdate"]?></font></td>
</tr>
<tr>
<td class="header"><font size="-3">LOCATION</font></td>
<td class="name"><font size="-3"><?=$row["location"]?></font></td>
<td class="header"><font size="-3">DISTANCE</font></td>
<td class="name"><font size="-3"><?=$row["distance"]?></font></td>
</tr>
<tr>
<td class="header"><font size="-3">REF LOCATION</font></td>
<td class="name"><font size="-3"><?=$row["location2"]?></font></td>
<td class="header"><font size="-3">DIRECTION</font></td>
<td class="name"><font size="-3"><?=$row["direction"]?></font></td>
</tr>
<tr>
<td class="header"><font size="-3">FILE NAME</font></td>
<td class="name"><font size="-3"><a href='http://reports/traffic/findFile.php?siteCode=<?=$row["site_code"]?>'><?=$row["filename"]?></a></font></td>
</tr>
</table>
[/COLOR]