Discover Habbo's history
Treat yourself with a Secret Santa gift.... of a random Wiki page for you to start exploring Habbo's history!
Happy holidays!
Celebrate with us at Habbox on the hotel, on our Forum and right here!
Join Habbox!
One of us! One of us! Click here to see the roles you could take as part of the Habbox community!


Page 2 of 5 FirstFirst 12345 LastLast
Results 11 to 20 of 49
  1. #11
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Aside from the **** that's been posted, I was actually focusing on this:
    SELECT * FROM `private_messages` WHERE `'".$u->."'id` = '".$sess_id."' ORDER BY date DESC
    How would I make it so I could add $u->id ($u being a whole different query, and id is gradding the `id` data from that query) into the query above?

  2. #12
    Join Date
    Sep 2006
    Location
    Evanston, Illinois.
    Posts
    2,361
    Tokens
    0

    Latest Awards:

    Default

    I don't really understand what you want to do, but if it's get $u->id it'll be

    SELECT * FROM `private_messages` WHERE `{$u->id}` = '{$sess_id}' ORDER BY date DESC

    Can you elaborate on what the variables are, and what you want to do.
    How could this hapen to meeeeeeeeeeeeeee?lol.

  3. #13
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Never mind, I got it.

    Thanks Denta for the only contributing post (that helped, and the one above from Charlie) in this thread.

  4. #14
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    PHP Code:
    SELECT FROM `private_messagesWHERE `uid`='$sess_id' ORDER BY date DESC 
    If $u->id is from a different query, can you post that?

    @edit: Just saw your post, what was wrong?

  5. #15
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    I had:

    PHP Code:
    mysql_query("SELECT * FROM `private_messages` WHERE $u->id = '".$sess_id."' ORDER BY date DESC"); 
    When really it should be (what it is currently):

    PHP Code:
    mysql_query("SELECT * FROM `private_messages` WHERE `'".$u->id."' = '".$sess_id."' ORDER BY date DESC"); 
    What would I do if I wanted to only display messages from a single person, I know that's what that code should accomplish but...

    All that is going to do is fetch private_messages where the user's id = the logged in user's id. How would I make it so that it'll only grab the PM's which have that user's id - because the private messages table doesn't even have any refrence to a user id. (that most likely doesn't make sense)

    So what I'm trying to say is: it will not fetch the private messages for the user that's logged in.

    EDIT:
    Once again, got it.
    Last edited by wsg14; 26-07-2008 at 01:07 AM.

  6. #16
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Yay, another problem! (well not a problem, but w.e)

    PHP Code:
    $today date("m.d.Y");
    $yesterday = ($today--); 
    I know you can do $variable++; but can you do $variable--;?

    What I'm trying to do is said in the variable name, $yesterday. I'm trying to make it grab the date, but make it negative one so it displays yesterday's date. Is that the right way to do it? If not what is the right way?

  7. #17
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    I'm not going to tell you how to do it.

    You try it first

  8. #18
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    Using mktime and date, PHP.net give you a basic outline of it on their func date page.

    Dont look if you dont want me to give it away to you.
    Hi, names James. I am a web developer.

  9. #19
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    Thanks Protege, but found the mktime documentation on PHP.net earlier.

    Just hitting one problem that;s stopping me from continuing.

    PHP Code:
    <?php

    $query 
    mysql_query("SELECT * FROM `private_messages` WHERE `to` = '".$sess_username."' ORDER BY date DESC");
    $display mysql_fetch_array($query);
    $pm_count mysql_num_rows($query);
    $today date("m.d.Y");
    $yesterday mktime(000date'm' )  , date'd' ) - 1date'y' ));

    if(
    $pm_count == 0){
        echo 
    'You do not have any messages at this time.';
    } else{
        if(
    $query->send_date == $today){
            echo 
    '<b>Today</b><br />';
            if(!
    $read == 0){
                echo 
    '<b>$display[\'name\']</b> - $display[\'from\']<br />';
            } else {
                echo 
    '$display[\'name\'] - $display[\'from\']<br />';
            }
        }
        if(
    $query->send_date == $yesterday){
            echo 
    '<b>Yesterday</b>';
            if(!
    $read == 0){
                echo 
    '<b>$display[\'name\']</b> - $display[\'from\']<br />';
            } else {
                echo 
    '$display[\'name\'] - $display[\'from\']<br />';
            }
        }
        
    }

    ?>
    Error:
    Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/kolzy/public_html/ws/private.php on line 21

    Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/kolzy/public_html/ws/private.php on line 22
    Line 21:
    PHP Code:
    $display mysql_fetch_array($query); 
    Line 22:
    PHP Code:
    $pm_count mysql_num_rows($query); 
    I tried using a while statement, that got rid of the first error but not the error for line 22. Would I use two while statements?

  10. #20
    Join Date
    Jul 2008
    Posts
    119
    Tokens
    0

    Default

    Because its going to be selecting more than 1 pm you need to use while;

    PHP Code:
    $pm_count mysql_num_rows($query);
    $today date("m.d.Y");
    $yesterday mktime(000date'm' )  , date'd' ) - 1date'y' ));

    if(
    $pm_count == 0){
        echo 
    'You do not have any messages at this time.';
    } else{
      while ( 
    $display mysql_fetch_array $query ) ) {
         if(
    $query->send_date == $today){
             echo 
    '<b>Today</b><br />';
             if(!
    $read == 0){
                 echo 
    '<b>$display[\'name\']</b> - $display[\'from\']<br />';
             } else {
                 echo 
    '$display[\'name\'] - $display[\'from\']<br />';
             }
         }
         if(
    $query->send_date == $yesterday){
             echo 
    '<b>Yesterday</b>';
             if(!
    $read == 0){
                 echo 
    '<b>$display[\'name\']</b> - $display[\'from\']<br />';
             } else {
                 echo 
    '$display[\'name\'] - $display[\'from\']<br />';
             }
      }

    EDIT: allso i may be wrong but i dont think the variables in that will work becuase of the \ in them;

    PHP Code:
    echo '$display[\'name\'] - $display[\'from\']<br />'
    If you were getting a error before you changed it u should have changed it to this;

    PHP Code:
    echo $display['name'] . " - " $display['from'] . "<br />"



    Last edited by Tom-743; 26-07-2008 at 06:45 PM.
    Signature Removed by Jamesy (Forum Super Moderator): Referal

Page 2 of 5 FirstFirst 12345 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •