SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I've used the following command, is it correct?

    <input type="hidden" name="date" value="<?php echo date("d M, Y") ?>">


    I was hoping that when the user submits the form, the date in the format of 11 Dec, 2000 would be enter to MySQL, but nothing shows up in the database.

    The date field in MySQL is set to VARCHAR (14) not null


  2. #2
    SitePoint Enthusiast
    Join Date
    Oct 2000
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if i am not wrong date field in mysql is something like this
    year-month-day

    2000-02-33
    Great Dane
    Gokhan ARLI

  3. #3
    AdSpeed.com Son Nguyen's Avatar
    Join Date
    Aug 2000
    Location
    Silicon Valley
    Posts
    2,241
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No, since Robo used VARCHAR(14) and not the date of MySQL
    Robo, test the hidden field if it produces the correct format (view src), I believe it is.

    If it's the correct format then the problem will be at the part you enter the data into your DB. You should post the code here so we could help.
    - Son Nguyen
    AdSpeed.com - Ad Serving and Ad Management Made Easy

  4. #4
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Got it sorted, seems that the script didn't like where I put the command, shifted the line and it worked...

    Now I have another small question, what would I need to do so that I can have a created date? So the date is the first time the recorded is added, and it doesn't change, the function I have now changes everytime someone edits the record.

    It's probably really simple, just can't think...

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just don't update the date field each time. I assume you have an inert statement for adding new records that sets the date field to the value of your hidden field, and you have an update statment. In your update statement just don't update that particular field
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    midnight coder
    Join Date
    Dec 2000
    Location
    The flat edge of the world
    Posts
    838
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, I knew it's something simple...


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
  •