mwm
08-23-2006, 02:15 PM
The script below loops and pulls the id and lot from the db just fine. But when i click on the link "view" it only displays the last row in the loop. I hope the makes sence.
<?
session_start();
include "conn.php";
$contractor = $_POST['contractor'];
?>
<html>
<body bgcolor="lightpink">
<form action=".php" method="POST">
<h1><p align=center>The Corporation</p></h1>
<h3><p align=center>BACK CHARGE SEARCH</center></p></h3>
<h4><p align=center><i>Search Back Charge</i></center></p></h4>
<input type="button" value="Main" style="font-size:15" onClick="parent.location='backchargemain.php'">
<?
$mysql1 = "select id,lot from bc where contractor = '$contractor' ";
$result1= mysql_query($mysql1) or die ("Can't connect");
echo "<table border=\"0\">";
echo "<th>id</th>";
echo "<th>Lot Date</th>";
echo "<th></th>";
$j = 0;
while ($row = mysql_fetch_array($result1)) {
$id = $row['id'];
for ($i= 0; $i<$result1; $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#FFFFFF">';
echo "<td>" .($row['id']) . "</td>";
echo "<td>" .($row[1]) . "</td>";
//echo "<td>" .($row[2]) . "</td>";
//echo "<td>" .($row['contractor']) . "</td>";
//echo "<td>" .substr($row['description'],0,25) . "</td>";
//echo "<td>" .($row['status']) . "</td>";
print '
<td>
<a href="viewdisplay.php?id='.$row['id'].'">View</a>
</td>
';
}
echo '</table>';
echo "</center>";
echo "<hr>";
?>
</form>
</body>
</html>
<?
session_start();
include "conn.php";
$contractor = $_POST['contractor'];
?>
<html>
<body bgcolor="lightpink">
<form action=".php" method="POST">
<h1><p align=center>The Corporation</p></h1>
<h3><p align=center>BACK CHARGE SEARCH</center></p></h3>
<h4><p align=center><i>Search Back Charge</i></center></p></h4>
<input type="button" value="Main" style="font-size:15" onClick="parent.location='backchargemain.php'">
<?
$mysql1 = "select id,lot from bc where contractor = '$contractor' ";
$result1= mysql_query($mysql1) or die ("Can't connect");
echo "<table border=\"0\">";
echo "<th>id</th>";
echo "<th>Lot Date</th>";
echo "<th></th>";
$j = 0;
while ($row = mysql_fetch_array($result1)) {
$id = $row['id'];
for ($i= 0; $i<$result1; $i ++) {
}
echo ($j++%2==0) ? '<tr bgcolor="#FFFFCC">' : '<tr bgcolor="#FFFFFF">';
echo "<td>" .($row['id']) . "</td>";
echo "<td>" .($row[1]) . "</td>";
//echo "<td>" .($row[2]) . "</td>";
//echo "<td>" .($row['contractor']) . "</td>";
//echo "<td>" .substr($row['description'],0,25) . "</td>";
//echo "<td>" .($row['status']) . "</td>";
print '
<td>
<a href="viewdisplay.php?id='.$row['id'].'">View</a>
</td>
';
}
echo '</table>';
echo "</center>";
echo "<hr>";
?>
</form>
</body>
</html>