treehouse : what would you like to learn today?
Web Design Web Development iOS Development

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

  • 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



    $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:

    http://grab.by/6da

    any way to get the date formatted right?
  • what if you did this

    $date = date(“Ymd”);

    instead of this

    $date=date(“Ymd”);
  • Found out how :)

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

    Thanks for your help though