1. No Profile Picture
    Devshed Newbie (0 - 499 posts)
    I need help, I am trying to pass a date value like "1999-08-21" into mySQL database, it is not saving to the database.

    Here is the code
    if( isset($category) && isset($product) && isset($saleprice) && isset($entrydate)){
    mysql_connect)"localhost", "webuser", "");
    $query = "INSERT INTO items VALUES('$category', '$product', '$saleprice', '$entrydate', NULL)";
    $result = mysql_db_query("onsale", $query);
    if ($result) {
    echo "added";

    where onsale is the mySQL database, items is a table, and saleprice is decimal(6,2) and entrydate is date and last column is ID a primary key with auto_increment and an no null value.
  2. #2
  3. No Profile Picture
    rod k
    Devshed Newbie (0 - 499 posts)
    It's not adding anything or just the date? How to proceed depends on that. A couple things to check.

    Print the values you are trying to add to make sure they have what you think they have.

    check mysql_error()

    "describe" the table from the command line to make sure the columns are set to the types you think they are.

    From your code and what you describe this should work.

Similar Threads

  1. Replies: 13
    Last Post: June 4th, 2004, 04:49 PM
  2. Need advice designing a usage tracking database (MySQL)
    By Randolpho in forum Database Management
    Replies: 0
    Last Post: February 13th, 2004, 04:11 PM
  3. Replies: 3
    Last Post: February 11th, 2004, 08:30 AM
  4. mysql date time stamp and UTF8
    By doomish in forum MySQL Help
    Replies: 0
    Last Post: February 8th, 2004, 08:37 AM
  5. database date selection problem
    By kidsleep in forum MySQL Help
    Replies: 0
    Last Post: January 31st, 2004, 10:50 AM

IMN logo majestic logo threadwatch logo seochat tools logo