RE: [PHP] What's wrong with this date ?
| From: | Andrew Forgue | Date: | Sun, 18 Nov 2001 06:11:22 +0000 |
| Subject: | RE: [PHP] What's wrong with this date ? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-75024@lists.php.net to get a copy of this message | ||
Well it should be '$date',
Also.. If the column type is date and you are entering it for a form,
check to make sure you are typing it in ok and you trim() the variable
if It still doest work... do a <? print $query ?> before the mysql_query()
and see exactly what its inserting...
-----Original Message-----
From: trongduc [mailto:trongduc@tlnet.com.vn]
Sent: Saturday, November 17, 2001 8:17 PM
To: php-general@lists.php.net
Subject: [PHP] What's wrong with this date ?
hi there,
I try to save a record (in the "date" type in MySQL) from the <INPUT
type=text> by :
$query = "INSERT INTO $table VALUES ($post_id, 0, '$topic', '$uname',
'$body', $date, '$newdate', 0) ";
But it couldn't work (I used $date or '$date' on above, but they got the
same results) !
It showed me the wrong value, as : 1970-0-0 (always this, although I try to
input different values in the text box with the date format is YYYY-MM-DD)
I don't understand the way MySQL saves my date field in his data (is it
YYYY-MM-DD ?)
Can anyone help me in this case ?
Thanks much...
ps : I used the $date field in "varchar(20) type" instead. BWT, what's
different beween the Varchar(length) type with the Char(length) type ?
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net