So basically, i'm trying to make some sort of timeline with the post of my users, that gives me the posts of all users ordered by time. But instead, gives me the following:
*User1 'post1',
User1 'post2',
User1 'post3'..
*User2 'post1',
User2 'post2',
User2 'post3'..
I want all the post ordered instead of all the posts from user1 then all the posts from user2, etc. Well i hope it made sense thank you guys.
The query
<?php
$varq1 = mysql_query('SELECT id2 FROM followers WHERE id ="'.$_SESSION['id'].'"');
while($req5 = mysql_fetch_array($varq1)){
$req9=$req5['id2'];
$nsql = mysql_query('SELECT content, id, profile_id FROM contenido WHERE profile_id in("'.$req9.'") order by content_time desc');**strong text**
while($nrow = mysql_fetch_array($nsql)){
?>
The HTML/ php call
<div class="divider">
<center><?php echo "".$nrow['content'].""; ?><center/>
</div>
mysql_real_escape_string. There's a reasonmysql_queryis deprecated and should not be used in new applications, and it's that the interface is dangerous by default, prone to SQL injection bugs of the worst kind.mysql_*functions in new code. They were removed from PHP 7.0.0 in 2015. Instead, use prepared statements via PDO or MySQLi. See Why shouldn't I use mysql_* functions in PHP? for more information.