PHP help

Discussion in 'General Off-Topic Chat' started by khan, May 23, 2007.

May 23, 2007

PHP help by khan at 3:43 PM (805 Views / 0 Likes) 8 replies

  1. khan
    OP

    Member khan GBAtemp Maniac

    Joined:
    Mar 17, 2003
    Messages:
    1,320
    Country:
    Pakistan
    Hi all,

    In my free time, I am trying to make a professional looking website on which I would like to display date with message i.e. good morning/afternoon/evening or night.

    I have found a very basic php script however I would really appreciate if someone could expand it so it prints out message along side the side as mentioned above. (BTW I have tried google to no avail)

    [/color]

    Thanks
     
  2. Kyuzumaki

    Member Kyuzumaki GBAtemp Regular

    Joined:
    Dec 24, 2006
    Messages:
    251
    Country:
    United Kingdom
    i don't have time to check the syntax costello will probably know but you just need a few if's. time() is a number indicating how many seconds have passed since midnight

    so something like
    //before 12noon
    if(time()43200 & time()64800 & time()75600){echo("Good night")}
     
  3. WishCow

    Newcomer WishCow Advanced Member

    Joined:
    Jul 24, 2006
    Messages:
    85
    Country:
    Hungary
    date('H'); returns the hour of the day, so you can do ifs:

    if (date('H') > 12) {
    echo("It's past twelve");
    }
     
  4. FrozenOne23

    Member FrozenOne23 GBAtemp Regular

    Joined:
    Sep 23, 2006
    Messages:
    174
    Country:
    Netherlands
    Uhm, time() is a function to display the seconds since January 1 1970 00:00:00 GMT
     
  5. Kyuzumaki

    Member Kyuzumaki GBAtemp Regular

    Joined:
    Dec 24, 2006
    Messages:
    251
    Country:
    United Kingdom
    ooo lol not used time() in php yet i assumed it was the same.
     
  6. Sinkhead

    Former Staff Sinkhead yay p1ngpong.

    Joined:
    Nov 22, 2006
    Messages:
    3,692
    Location:
    Across the pond
    Country:
    United Kingdom
    To print a message in PHP use
    CODE
    So in your example you would use
    CODE

    I made a sample script here. Oh, and by the way, PHP uses the server's time so things get a little funky when timezones are brought in. You need to collect the time offset from server time from the user then store it somewhere and when the time is needed the difference should be calculated from server time. But that's only if you want to be clever.
    - Sam
     
  7. khan
    OP

    Member khan GBAtemp Maniac

    Joined:
    Mar 17, 2003
    Messages:
    1,320
    Country:
    Pakistan
    Thank you all for your suggestions/help.

    I am now working on a search engine which works as I wanted to however when there are more than 1 matching results then it still produces 1 single table display just 1 output result.

    I was wondering if some kind soul could help me out here, I just want php page to display a separate table with product details for every result it finds( i.e. if 2 products match search string then I would like 2 tables).

    Thanks in advance
     
  8. Kasoz

    Newcomer Kasoz Advanced Member

    Joined:
    May 16, 2007
    Messages:
    97
    Country:
    Netherlands
    You definetly need to learn some more PHP, this is really basic, and you can learn all these kind of things from a good book anyway, you only fetch 1 row, instead of multiple rows

     
  9. khan
    OP

    Member khan GBAtemp Maniac

    Joined:
    Mar 17, 2003
    Messages:
    1,320
    Country:
    Pakistan
    Thanks alot Kasoz for your help. It works
     

Share This Page