Grow your CSS skills. Land your dream job.

Mix Queries?

  • # July 16, 2012 at 11:30 pm

    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;
    $idwhoto = $rowz;
    $whotonameq = mysql_query("SELECT * FROM users_table WHERE id = '$idwhoto'");
    while($manz = mysql_fetch_assoc($whotonameq)){
    $whotoname = $manz;
    }
    $idwhois = $rowz;
    $comment = $rowz;
    $img = $rowz;
    ?>
    something like
    < ?php echo($username); ?> ...
    < ?php
    }}
    ?>

    The results would be something like this:

    Post by James 12th

    Post by James 15th

    ---
    Post by Bob 13th

    Post by bob 17th

    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

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".