|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate 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
|
|||
|
|||
|
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. |
|
#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:
you are already ignoring it. Could you post up the sql of your table? |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Timestamp(14) |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|