SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)

    Problem inserting Unix Time

    I am trying to insert a Unix Time into my database and this code is not working...
    PHP Code:
        $q2 "UPDATE member
                SET logged_in=?,
                    last_activity=time(),
                    updated_on=NOW()
                WHERE id=?
                LIMIT 1"
    ;

                
    // Prepare statement.
                
    $stmt2 mysqli_prepare($dbc$q2);

                
    // Bind variables to query.
                
    mysqli_stmt_bind_param($stmt2'si'$loggedIn$memberID); 
    What am I doing wrong?


    Debbie

  2. #2
    SitePoint Wizard DoubleDee's Avatar
    Join Date
    Aug 2010
    Location
    Arizona
    Posts
    3,764
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    This appears to have fixed things...
    Code MySQL:
    	$q2 = "UPDATE member
    			SET logged_in=?,
    				last_activity=UNIX_TIMESTAMP(now()),
    				updated_on=now()
    			WHERE id=?
    			LIMIT 1";

    Thanks,


    Debbie

  3. #3
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,250
    Mentioned
    59 Post(s)
    Tagged
    3 Thread(s)
    why would you use unix epoch times for last activity, and datetimes for updated_on?

    stick to DATETIME for both

    and this should have been part of your other thread
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


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
  •