I'm making and instagram parody and I need to make a feed. I have 2 tables "following" and "Posts".
This is the "following" database:
This is the "posts" database:
Here is my code to try and select the people that the user follows and put their posts into their feed:
<?php
$username = $_SESSION['username'];
$sql = "SELECT username_follow FROM following WHERE follower = '$username'";
$rsu = mysql_query($sql, $conn);
while ($row = mysql_fetch_array($rsu)){
$uername2 = $row[0];
$sql2 = "SELECT pic, `time` FROM `Posts` WHERE username = '$uername2' ORDER BY `Posts`.`id` DESC";
$res = mysql_query($sql2, $conn);
//echo $row[0];
while ($row2 = mysql_fetch_row($res)) {
echo "<br> <br>";
echo "<center>";
echo "<img width='450px' height='450px' src='data:image;base64,".base64_encode($row2[0])."'>";
echo "<br> <br>";
echo "</center>";
}
}
?>
But how can I show the pictures in chronological order?