So basically, I'm making a facebook-like wall. Now I have a database where I store every wallpost by who posts, where, contents etc. When making this wall, mixing every post made by everyone the user follows, the wall got organized by the name rather than the ids. So it became "Posts by James" then their posts, then "Post by Bob" and his posts, although the posts should be one by each sorted by ID. Here is somewhat how I made the wall:
<?php $queryz = mysql_query("SELECT * FROM users_follow_table WHERE hefollows = '$username' ORDER BY RAND()"); $aquery = mysql_query("SELECT * FROM users_wall_table WHERE name = '$fname' ORDER BY unique_id DESC LIMIT 0, 3"); while ($rowz = mysql_fetch_assoc($aquery)){ $unique_id = $rowz['unique_id']; $idwhoto = $rowz['id']; $whotonameq = mysql_query("SELECT * FROM users_table WHERE id = '$idwhoto'"); while($manz = mysql_fetch_assoc($whotonameq)){ $whotoname = $manz['username']; } $idwhois = $rowz['userid']; $comment = $rowz['comment']; $img = $rowz['img']; ?> something like <div class="post"><?php echo($username); ?> ... <?php }} ?>
The results would be something like this:
<div class="post">Post by James 12th</div> <div class="post">Post by James 15th</div> --- <div class="post">Post by Bob 13th</div> <div class="post">Post by bob 17th</div>
You see my point? - Now this is not exactly what it is, if you see any bugs it's because of the c/p and editing, not the code itself, it is working.
I know there is, but do you know of a better way to do this?
When making this wall, mixing every post made by everyone the user follows, the wall got organized by the name rather than the
ids. So it became "Posts by James" then their posts, then "Post by Bob" and his posts, although the posts should be one by each sorted
by ID. Here is somewhat how I made the wall:
The results would be something like this:
You see my point? - Now this is not exactly what it is, if you see any bugs it's because of the c/p and editing, not the code itself, it is working.
I know there is, but do you know of a better way to do this?
Thanks
- Schart