I'm building a torrent site and have an array with torrent data ($torrent_data). For each loop I make a SELECT from the database (yeah yeah I know...), then put the name of the torrent in $name and the timestamp in $upload_timestamp. Everything works so far. But when I convert the timestamp with date() or gmdate() it just convert the first date. Check the output!
Code: Select all
<?php
$i=0;
while ($i<$torrent_amount) {
$torrent_id = $torrent_data[$i]["id"];
$torrent_table = mysql_query("SELECT name, date FROM torrent WHERE id='$torrent_id'");
$name = mysql_result($torrent_table, 0, "name");
$upload_timestamp = mysql_result($torrent_table, 0, "date");
$upload_date = date("Y-m-d, H:m", $upload_timestamp);
print $torrent_name.", ";
print $upload_timestamp.", ";
print $upload_date."<br>";
$i++;
}
?>torrent1, 1206961055, 2008-03-31, 12:03
torrent2, 1206957978, 2008-03-31, 12:03
torrent3, 1206959500, 2008-03-31, 12:03
strange thing is that $torrent_name and $upload_timestamp is redeclared as they should each loop, but not $upload_date. Anyone knows why!?