Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Codewalkers 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 September 19th, 2003, 07:07 AM
Hobokin Hobokin is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Wichita, Kansas, South West Asia
Posts: 5 Hobokin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Timestamp(14)

The way i understand it is if you specify timestamp for the database field you dont have to specify a value every time. for instance every time i post news I shouldnt have to specify a date if i have it set for timestamp. Thats great and all but.... whenever i dont specify it sets to 00000000000000. i have tried using these values for the INSERT query. '' / ' ' / 'NULL' / 'NOW()' <-- dont ask

anyway for the insert query what do i have to specify it as so it stores the current date.

Reply With Quote
  #2  
Old September 19th, 2003, 11:55 AM
Jester Jester is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: England
Posts: 271 Jester User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Timestamp(14)

This is a bit wierd - with timestamp you just ignore it and it updates itself, whenever the record is altered. You don't include it in any UPDATES or INSERTs at all.

But from your post
Quote:
every time i post news I shouldnt have to specify a date if i have it set for timestamp

you are already ignoring it. Could you post up the sql of your table?

Reply With Quote
  #3  
Old September 20th, 2003, 10:57 AM
Hobokin Hobokin is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: Wichita, Kansas, South West Asia
Posts: 5 Hobokin User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
RE: Timestamp(14)

id INT(10) unsigned NOT NULL AUTO_INCREMENT, postdate TIMESTAMP(14), headline VARCHAR(50) NOT NULL ..............PRIMARY KEY(id), KEY postdate (postdate).....


I use this line to insert

$query = "INSERT INTO news VALUES (' ', ' ', 'This is a made up headline',.............................

the second space being the date. Would this work better?

$query = "INSERT INTO news VALUES (' ', , 'This is another made up headline',............................


Any help would be really appreciated

Reply With Quote
  #4  
Old September 20th, 2003, 05:29 PM
Jester Jester is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Location: England
Posts: 271 Jester User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 2
RE: Timestamp(14)

Okay - the actual full syntax for the type of INSERT your doing looks a little more like this:

INSERT [insertoptions] INTO tablename [(columnlist)] VALUES (valuelist)

There are three types of syntax for the INSERT - and I usually use the SET type with specific fields, but any type will do - it's just become habbit

Try changing you statement to:

$query = "INSERT INTO news (headline, otherfield names, sperated by commas) VALUES ('This is another made up headline', 'plus other', 'values')

Notice I did not reference your primary key, or timestamp fields?
This should work... in theory... hopefully :laugh:

If not, could you post your whole table structure up and example of full sql you are using and I'll drop them into a tester.

Good luck, J

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > Timestamp(14)


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