SitePoint Sponsor

User Tag List

Results 1 to 2 of 2

Thread: localtime()

  1. #1
    SitePoint Zealot
    Join Date
    May 2002
    Posts
    144
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    localtime()

    can anyone give me examples on how to use localtime() of php? was trying to use it like below

    if ($submitmsg == "SUBMIT") {
    $shoutout = "INSERT INTO shoutout SET
    poster='$postername',
    msg='$message',
    time=localtime()";
    but it doesn't work though sorry if this is too simple, I am a newb

  2. #2
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    90
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you can't have the localtime() function withing the string of text, it won't execute the function. so the query should be like.
    PHP Code:
    if ($submitmsg == "SUBMIT") { 
        
    $shoutout "INSERT INTO shoutout SET 
            poster = '
    $postername', 
            msg = '
    $message', 
            time = " 
    localtime();

        
    $sql mysql_query($shoutout); 


Bookmarks

Posting Permissions

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