|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Hi all,
I'm using Mitch's Multi-Page Article System . Right now I have a field in it where I can just type the date of when an article is posted. Does anyone know of way to have the date of when the article was written automatically written with the posts. Help! Tried looking for it at PHP.net, but that just confused me even more. Thanks ![]() |
|
#2
|
||||
|
||||
|
Dump the date entry field, look for the INSERT query, and replace the field variable with the string NOW().
|
|
#3
|
|||
|
|||
|
Could you possibly show me an example?
I don't know if you're familiar with this script, but there are two files, a "addarticles.php" file and "showarticles.php" file. Which do I edit? Thanks ![]() |
|
#4
|
||||
|
||||
|
I'm not familiar with the script, but you can address this by looking for an INSERT query in the code and doing a simple replacement. I'll fabricate a query to serve as an example:
Code:
INSERT INTO table (name,email,text,post_date) VALUES("Donkey Kong","donkey@kong.com","This is a nifty post.","2003-04-07");
Assume that's the original code and that the value inserted in the "post_date" slot is currently being pulled from a form field. In order to auto-set this value to today's date, you would change the query to read as follows: Code:
INSERT INTO table (name,email,text,post_date) VALUES("Donkey Kong","donkey@kong.com","This is a nifty post.",NOW());
It would also pay, from a user's standpoint, to remove the date form field from the user interface. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > MySQL Development > Help needed with using dates with MySQL/PHP Scripts |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|