#1
  1. No Profile Picture
    Heath
    Guest
    Devshed Newbie (0 - 499 posts)
    How do I pass the CURDATE() mySQL function in a PHP query???

    Obviously, I'm missing something real simple here.

    Trying to use PHP to pass "NOW" as the date in a date field. "quest_date" is the not null date field(below).

    I just want the current date inserted where I have "NULL" below.


    This Insert isn't working:

    $query = "INSERT INTO questions (quest_name, quest_email, cat_id, quest_show, quest_text, quest_ip, quest_date) VALUES ('$quest_name', '$quest_email','$cat_id', 't', '$quest_text', '$orig_ip', NULL)";


    Is there a way to add the CURDATE() mySQL function to where the "NULL" is above?

    Forgive my ignorance.

    Thanks in advance.
  2. #2
  3. No Profile Picture
    cheny
    Guest
    Devshed Newbie (0 - 499 posts)
    $query = "INSERT INTO questions VALUES ('$quest_name', '$quest_email','$cat_id', 't', '$quest_text', '$orig_ip', 'CURDATE())";
  4. #3
  5. No Profile Picture
    cheny
    Guest
    Devshed Newbie (0 - 499 posts)
    I really screwed up the answer, this is it I hope :-)

    $query = "INSERT INTO questions VALUES ('$quest_name', '$quest_email','$cat_id', 't', '$quest_text', '$orig_ip', 'CURDATE()')";
  6. #4
  7. No Profile Picture
    cheny
    Guest
    Devshed Newbie (0 - 499 posts)
    I'm really exhausted I think. Just type CURDATE() not 'CURDATE()'.

    There's no stupid question but dumb answers. One should always avoid sleep depreva tion.
  8. #5
  9. No Profile Picture
    Heath
    Guest
    Devshed Newbie (0 - 499 posts)
    Worked perfect - thanks a million

Similar Threads

  1. A problem with Dev C++ that skips some questions.
    By warnesey in forum C Programming
    Replies: 3
    Last Post: December 20th, 2003, 01:14 PM
  2. Load Data Stupid Questions !
    By toyug in forum MySQL Help
    Replies: 0
    Last Post: December 2nd, 2003, 11:31 PM
  3. Replies: 2
    Last Post: November 7th, 2003, 05:16 PM
  4. A few Install questions
    By kolatracks in forum Linux Help
    Replies: 2
    Last Post: October 27th, 2003, 02:31 AM
  5. Online news database performance questions
    By zbriu in forum MySQL Help
    Replies: 2
    Last Post: May 8th, 2003, 09:38 PM

IMN logo majestic logo threadwatch logo seochat tools logo