Hi all,
Is it possible to use the same javascript code in a while loop? The first record that is pulled from the database displays the javascript counter. Yet on the second iteration of the while loop (a new record pulled from the database), the javascript just seems to get ignored by php. Here is the section of code:
<?php
$request = mysql_query("SELECT * FROM auctions WHERE category_id BETWEEN '12' AND '84' ORDER BY a_timestamp DESC");
echo '<h1>'.$_GET['ctg'].' auctions</h1>';
$i = 0;
while ($i <= 6 and $result = mysql_fetch_assoc($request)) {
$time = $result['a_timestamp'];
$length = $result['a_length'];
$expires = strtotime($time. '+' .$length. 'days');
$expires = date('m/d/Y g:i A',$expires);
?>
<table border="0" cellpadding="5px">
<tr class="shade1">
<td rowspan="3" height="50px" width="50px">
<?php echo "<img src=https://students.ee.port.ac.uk/ece60363/".$result['a_image'] ." height=70px width=70px>"; ?>
</td>
<td class="error">Buy it Now price: £<?php echo $result['a_buyitnow']; ?></td>
<td class="error">Current Price: £</td>
<td class="error">
Time Remaining:
<script language="JavaScript">
TargetDate = "<?php echo $expires; ?>";
BackColor = "";
ForeColor = "";
CountActive = true;
CountStepper = -1;
LeadingZero = true;
DisplayFormat = "%%D%% Days %%H%% Hrs %%M%% Mins %%S%% Secs";
FinishMessage = "Auction Ended!";
</script>
<script language="JavaScript" src="/ece60363/count.js"></script>
</td>
</tr>
<tr class="shade2">
<td colspan="2"><a href="/ece60363/auction.php?auc=<?php echo $result['a_id']; ?>">
<?php echo $result['a_title'];?></a>
</td>
<td>Quantity Remaining: <?php echo $result['a_quantity']; ?></td>
</tr>
<tr class="shade1">
<td colspan="6" rowspan="2"><?php echo $result['a_description'];?></td>
</tr>
<tr>
</tr>
</table>
<hr>
<?php
$i++;
}
?>
Any thoughts???