Цитата(Папараццы @ 22.10.2007, 08:16 ) | | $query="INSERT INTO event('date') VALUES ('".$date."') "; |
Имена полей нужно обрамлять обратными апострофами, а не кавычками.
| Код | $query="INSERT INTO event(`date`) VALUES ('".$date."')";
|
Цитата(dsCode @ 22.10.2007, 15:38 ) | | Папараццы, да и не будет работать, потому что формат данных в MySQL для даты через тире. |
Зачем же гадать на кофейной гуще, когда есть полная документация? http://dev.mysql.com/doc/refman/4.1/en/datetime.html
| Цитата | You can specify DATETIME, DATE, and TIMESTAMP values using any of a common set of formats:
* As a string in either 'YYYY-MM-DD HH:MM:SS' or 'YY-MM-DD HH:MM:SS' format. A “relaxed” syntax is allowed: Any punctuation character may be used as the delimiter between date parts or time parts. For example, '98-12-31 11:30:45', '98.12.31 11+30+45', '98/12/31 11*30*45', and '98@12@31 11^30^45' are equivalent. * As a string in either 'YYYY-MM-DD' or 'YY-MM-DD' format. A “relaxed” syntax is allowed here, too. For example, '98-12-31', '98.12.31', '98/12/31', and '98@12@31' are equivalent. * As a string with no delimiters in either 'YYYYMMDDHHMMSS' or 'YYMMDDHHMMSS' format, provided that the string makes sense as a date. For example, '19970523091528' and '970523091528' are interpreted as '1997-05-23 09:15:28', but '971122129015' is illegal (it has a nonsensical minute part) and becomes '0000-00-00 00:00:00'. * As a string with no delimiters in either 'YYYYMMDD' or 'YYMMDD' format, provided that the string makes sense as a date. For example, '19970523' and '970523' are interpreted as '1997-05-23', but '971332' is illegal (it has nonsensical month and day parts) and becomes '0000-00-00'. * As a number in either YYYYMMDDHHMMSS or YYMMDDHHMMSS format, provided that the number makes sense as a date. For example, 19830905132800 and 830905132800 are interpreted as '1983-09-05 13:28:00'. * As a number in either YYYYMMDD or YYMMDD format, provided that the number makes sense as a date. For example, 19830905 and 830905 are interpreted as '1983-09-05'.
|
|