cammy
Member
- May 15, 2014
- 481
- 238
I'm currently trying to display the latest 6 photos taken by users as shown below...
But I don't know how to convert the user_id to the persons username. Nor do I know how to convert the timestamp to date and time.
Here's the current script.
But I don't know how to convert the user_id to the persons username. Nor do I know how to convert the timestamp to date and time.
Here's the current script.
<?php
$sql = $dbh->prepare("SELECT id,user_id,timestamp,url FROM camera_web ORDER BY id DESC LIMIT 6");
$sql->execute();
while ($photos = $sql->fetch())
{
echo'
<div class="boxphotos">
<a href="/news/'.filter($photos["id"]).'"><div class="photosimage" style="background-image: url('.filter($photos["url"]).');">
<div class="photosuser">
'.filter($photos["user_id"]).'
</div>
<div class="photostime">
'.filter($photos["timestamp"]).'
</div>
</div></a>
</div>';
}
?>