Page 3 of 5 FirstFirst 12345 LastLast
Results 21 to 30 of 49
  1. #21
    Join Date
    Mar 2008
    Location
    Swindon, UK
    Posts
    1,274
    Tokens
    187
    Habbo
    :Ltd

    Latest Awards:

    Default

    I dont understand why your using $query->send_date?
    Hi, names James. I am a web developer.

  2. #22
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    It's basically saying the the send_date table from private_messages = today's date.

    Is there another way to accomplish the same thing?

    Thanks Tom, but when I use your code you gave me for the echo $display... I had <b>code</b> in it. If I keep it I get an error "unexpected "<"".
    Last edited by wsg14; 26-07-2008 at 07:05 PM.

  3. #23
    Join Date
    May 2008
    Location
    Cheshire
    Posts
    133
    Tokens
    0

    Default

    try this
    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 />";
            }
        }
        
    }

    ?>

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

    Latest Awards:

    Default

    Dont think Dom's is right but I commented where I got stuck re-coding it.

    PHP Code:
    <?php

    $today 
    date'm.d.Y' );
    $yesterday date'm.d.Y'mktime000date'm' ), date'd' ) - 1date'y' ) ) );
    $mysqlQuery mysql_query'SELECT * FROM `private_messages` WHERE `to` = "' $sess_username '" ORDER BY `date` DESC' );
    if( 
    mysql_num_rows$mysqlQuery ) == )
    {
        echo( 
    'Sorry, you have no messages at the this present time' );
    }
    else
    {
        while( 
    $r mysql_fetch_array$mysqlQuery ) )
        {
            if( 
    $r'send_date' ] == $today )
            {
                echo( 
    'Today' );
            }
            elseif( 
    $r'send_date' ] == $yesterday )
            {
                echo( 
    'Yesterday' );
                
    // don't know where you define $read lol
            
    }
        }
    }
    ?>
    Hi, names James. I am a web developer.

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

    Default

    Thanks for the help Dom and Protege, but Tom beat you all to the punch.

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

    Latest Awards:

    Default

    Not to be pedantic but echo is not a function and therefore doesn't require parenthesis. It looks like a problem with how your outputting the data, download Aptana Studio for free, and debug in that (it will underline bad code).
    How could this hapen to meeeeeeeeeeeeeee?lol.

  7. #27
    Join Date
    Mar 2008
    Location
    Cardiff, S. Wales
    Posts
    536
    Tokens
    0

    Default

    Quote Originally Posted by Hypertext View Post
    Not to be pedantic but echo is not a function and therefore doesn't require parenthesis. It looks like a problem with how your outputting the data, download Aptana Studio for free, and debug in that (it will underline bad code).

    You're gay.

    Edited by Invent (Forum Moderator): Please don't be rude.
    Last edited by Invent; 26-07-2008 at 09:49 PM.

  8. #28
    Join Date
    May 2005
    Location
    San Francisco, CA
    Posts
    7,160
    Tokens
    2,331

    Latest Awards:

    Default

    Not to be pedantic but echo is not a function and therefore doesn't require parenthesis.
    Maybe so, but it does make debugging easier and doesn't slow down your script execution time badly.

  9. #29
    Join Date
    Mar 2008
    Posts
    5,108
    Tokens
    3,780

    Latest Awards:

    Default

    It is a language construct, but it works either ways. You can use it like you are calling it as a method/function.

    PHP Code:
    echo "hey"
    is the same as

    PHP Code:
    echo("hey"); 
    as well as the same as

    PHP Code:
    echo 'hey'
    as well as

    PHP Code:
    echo ('hey'); 
    So it really doesn't matter, but server setups vary.

    Aptana Studio free version isn't really good. I suggest you *look* for a professional copy of Aptana Studio with the PHP plugin, or a copy of Zend Studio for Eclipse (free 30 day trial)

    I would recommend Zend Studio over Aptana

  10. #30
    Join Date
    Jul 2008
    Posts
    535
    Tokens
    75

    Default

    I'll go hunting for Zend Studio later on. Is it better than phpDesigner 08?

Page 3 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
  •