$query = "SELECT item, description, price, imageData, status, username, item_id FROM items";
$result = mysql_query($query) or die(mysql_error());
$z=0;
while($row = mysql_fetch_array($result))
{
//echo other columns here//
echo "<td><div id=status$z></div></td>";
<script type=text/javascript>
function updatestatus(itemnum) {
var url="updatestatus.php?auc=<?php echo $row['item_id']; ?>";
jQuery('#status' + itemnum).load(url);
}
setInterval("updatestatus(<? echo $z?>)", 1000);
</script>
<?
$z++;
}
?>
So basically I'm trying to get Jquery to update the status of each auction once every second. However, the statuses for each row are all the same which is not right. It appears that all the rows are populated with the same status as the last row.
Here's the code for updatestatus.php
<?
session_start();
require_once("connect.php");
$id = $_GET['auc'];
$getstatus= mysql_query("SELECT status FROM items WHERE item_id = '$id' ");
$row = mysql_fetch_array($getstatus);
echo"$row[status]";
?>
Please let me know what I've done wrong.