SunQuest
 
           MySQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMySQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
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  
Old November 2nd, 2003, 01:32 AM
banx banx is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 33 banx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Talking Help needed with using dates with MySQL/PHP Scripts

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

Reply With Quote
  #2  
Old November 2nd, 2003, 07:16 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
Dump the date entry field, look for the INSERT query, and replace the field variable with the string NOW().

Reply With Quote
  #3  
Old November 2nd, 2003, 06:41 PM
banx banx is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 33 banx User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
  #4  
Old November 3rd, 2003, 06:52 AM
dhouston's Avatar
dhouston dhouston is offline
Contributing User
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: May 2003
Location: Tennessee
Posts: 1,355 dhouston User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via ICQ to dhouston
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.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Help needed with using dates with MySQL/PHP Scripts


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway