I want to change the position of a div-element every 3 seconds. The coordinates of the element are saved in the mysql-database. The problem is I only get the last value of the record, so it gets to one position and then never to the second one. Can somebody help me with this problem. (Sorry for my bad english)
[code=php]
echo ‘setInterval(“reset()”,3000);’;
$query = mysql_query(“SELECT * FROM homepage WHERE publiceer = 1”);
while ($row = mysql_fetch_object($query))
{
$query2 = mysql_query(“SELECT * FROM homepage WHERE id = ‘”.$row->id.”‘ LIMIT 1″);
while ($row2 = mysql_fetch_object($query2))
{
echo ‘function reset(){‘;
echo ‘document.getElementById(“slidecaption”).style.top = ‘.$row->positie_y.’ + “px”; document.getElementById(“slidecaption”).style.left = ‘.$row->positie_x.’ + “px”;’;
echo ‘alert(“‘.$row2->id.'”);’;
echo ‘}’;
}
// echo ‘alert(“‘.$row->id.'”);’;
}