Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

How does one insert a date through a PHP script?

407366Mar 31 2008 — edited Apr 3 2008
I have been stumped for several days on this problem.

My PHP script has an integrated HTML form.

One input field is for a date in format DD-MON-YY. Input type is text.

Everything else in my scripts works and loads fine...except the date variable containing the user's input.

I have tried setting a PHP environment value like so:

putenv("NLS_DATE_FORMAT=DD-MON-RR");

That does not work.

I have tried using the TO_DATE function in my INSERT statement's VALUES clause like so:

TO_DATE(<my $_POST['input Name attribute value']>,'DD-MON-RR')

That did not work.

I tried setting the date mask to its own variable, like so:

TO_DATE(<my $_POST['input Name attribute value']>,'$datemask varialbe')

That did not work.

If I hard code a date into the VALUES clause, like so:

'26-OCT-07'

That of course works.

FYI, I have written and use several dozen PHP scripts against an Oracle database, including a handful of INSERT scripts. They all work fine.

This is my first script taking user input including date fields.

I suspect I am missing something simple but cannot for the life of me figure it out.

Thanks for any assistance.

I find very, very little on the web about entering Oracle date data through PHP.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 1 2008
Added on Mar 31 2008
2 comments
10,410 views