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 October 13th, 2004, 03:02 PM
LordCeleborn LordCeleborn is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 LordCeleborn User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Ordering by DATE

DB Schematic
id (INT) autoinc.
ev_date (date)
user (VARCHAR)
notes (TEXT)

What I need is the piece of code to insert the
data into the db and finally a way to diplay them ordered
by DATE.

I have created a form that gives these:
$day , $month , $year , $user , $notes

I know how to insert the rest tell me how to handle the date
insertion.

Thank you in advance.

Reply With Quote
  #2  
Old October 13th, 2004, 05:17 PM
Viper_SB's Avatar
Viper_SB Viper_SB is offline
Moderator
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Location: Canada
Posts: 330 Viper_SB User rank is Private First Class (20 - 50 Reputation Level)Viper_SB User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 1 Day 4 h 51 m 6 sec
Reputation Power: 5
It depends if you just want the current date use the function now(), otherwise you can enter it in a few ways.
Code:
INSERT INTO (ev_date, user, notes) VALUES (now(), 'username', 'notes')
// or
INSERT INTO (ev_date, user, notes) VALUES ('2004-10-13', 'username', 'notes')


http://dev.mysql.com/doc/mysql/en/INSERT.html

Reply With Quote
  #3  
Old October 14th, 2004, 02:20 AM
ygoutham ygoutham is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2004
Posts: 1 ygoutham User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Quote:
Originally Posted by LordCeleborn
DB Schematic
id (INT) autoinc.
ev_date (date)
user (VARCHAR)
notes (TEXT)

What I need is the piece of code to insert the
data into the db and finally a way to diplay them ordered
by DATE.

I have created a form that gives these:
$day , $month , $year , $user , $notes

I know how to insert the rest tell me how to handle the date
insertion.

Thank you in advance.

Hi,
Try and create a unified field like
$newdate = $year."-".$month."-".$day;

coz mysql takes dates only in Y m d format and then try to run the insert query like

$result = mysql_query("insert into database_name set date='$date' where [clause]");


Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMySQL Development > Ordering by DATE


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 2 hosted by Hostway