Grow your CSS skills. Land your dream job.

Add date (using the php date()) to the MySQL

  • # September 26, 2009 at 6:44 pm

    Hi,
    I have made a registration for and have got it all working I have just not managed to make the date show up properly…
    in my MySQL there is the column "dateJoined" which is formatted as DATE and this is the PHP

    Code:
    $acceptHash = –
    $acceptHash .=–
    // cannot get this to show up!
    $date=date(“Ymd”);

    $addToDatabase = “INSERT INTO `–`.`users`
    (—-`dateJoined`)
    VALUES (
    —-
    ‘$date’

    );”;

    mysql_query($addToDatabase);

    in the database it show:

    [img]http://grab.by/6da[/img]

    any way to get the date formatted right?

    # September 27, 2009 at 12:51 am

    what if you did this

    $date = date(“Ymd”);

    instead of this

    $date=date(“Ymd”);

    # September 27, 2009 at 7:36 am

    Found out how :)

    Using:
    $date = date("Y-m-d");
    now.

    Thanks for your help though

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".