I have been struggling with this code now for a couple of days and was wondering if anyone can please assist me with it.
I have a form that has a link called Details.
If you click on the Details link, it will invoke this script and display the details of the records based on the id being passed to it.
So far, only id is being displayed, nothing else.
After scouring the internet for several days, I found an article that says that to do what I am trying to do, which is to display values for the rest of the fields, I needed to do a for loop.
Being so new at php, ( I am more of a vb programmer), I am having problem making the loop work for me.
Can someone kindly help me, please?
here is the entire code and thanks in advnce.
I have a form that has a link called Details.
If you click on the Details link, it will invoke this script and display the details of the records based on the id being passed to it.
So far, only id is being displayed, nothing else.
After scouring the internet for several days, I found an article that says that to do what I am trying to do, which is to display values for the rest of the fields, I needed to do a for loop.
Being so new at php, ( I am more of a vb programmer), I am having problem making the loop work for me.
Can someone kindly help me, please?
here is the entire code and thanks in advnce.
Code:
<?php
$conn = odbc_connect("counts", "", "") or die(odbc_error());
$cur = "SELECT fctrafic.id,fctrafic.location, fctrafic.location2,fctrafic.distance, fctrafic.direction,trafficCountsFiles.contentType, trafficCountsFiles.FileData FROM trafficCountsFiles,fctrafic where fctrafic.id = trafficcountsFiles.sitecode and fctrafic.id = '".$_GET["id"]."'";
$result=odbc_exec($conn,$cur);
$res = $cur->fetch();
for ($i=0; $i<12; $i++) {
$cn = strtoupper($cur->ColumnName($i));
$$cn = $cur->GetColumn($i);
$cv = $$cn;
}
echo " <div align=\"center\">
<table cellpadding='2' cellspacing='2'>
<td class='header'><font size='-3'>ID</font></td><td class='name'><font size='-3'>" . ((isset($id)) ? $id: 'No ID Found') . "</font></td><td class='header'><font size='-3'> TYPE</font></td><td class='name'><font size='-3'>" . ((isset($types)) ? $types : 'Type Not Available') . "</font></td></tr>
<td class='header'><font size='-3'>AADT</font></td><td class='name'><font size='-3'>" . ((isset($aadt)) ? $aadt : 'No Record Found') . "</font></td><td class='header'><font size='-3'> DATE</font></td><td class='name'><font size='-3'>" . ((isset($fdate)) ? $fdate : 'No Date Available') . "</font></td></tr>
<tr><td class='header'><font size='-3'>LOCATION</font></td><td class='name'><font size='-3'>" . ((isset($location)) ? $location : 'No Record Found') . "</font></td><td class='header'><font size='-3'>DISTANCE</font></td><td class='name'><font size='-3'>" . ((isset($distance)) ? $distance : 'No Record Found') . "</font></td></tr>
<tr><td class='header'><font size='-3'>REF LOCATION</font></td><td class='name'><font size='-3'>" . ((isset($location)) ? $location : 'No Record Found') . "</font></td><td class='header'><font size='-3'>DIRECTION</font></td><td class='name'><font size='-3'>" . ((isset($direction)) ? $direction : 'No Record Found') . "</font></td></tr>
<tr><td class='header'><font size='-3'>FILE NAME</font></td><td class='name'><font size='-3'>" . ((isset($files)) ? $files : 'No File(s) Found') . "</font></td></tr>
</table><br>
<button name=\"close\" value=\"Close\" onClick='window.close()'>Close</button>
</div>";
?>
</body>
</html>