Please i want to Insert data date in "textbox" with PHP to myssql. But i can't do it. And show it with format "dd/mm/yyyy" in table
A:
Use the date
function: http://www.php.net/manual/en/function.date.php
You have good examples at the manual page.
For parsing a date, you can use strtok
: http://www.php.net/manual/en/function.strtok.php
or explode
: http://www.php.net/manual/en/function.explode.php
Notinlist
2010-08-12 07:06:23
A:
As for formating the date, you can aswell format it within mysql query when returning it:
SELECT DATE_FORMAT(date, '%d %m %Y') FROM data;
Prix
2010-08-12 07:11:03
but i have two field. field 1: name, field 2: day of birth. i used followInsert into customer("name","DOB") values ("$txtname","$txtDOB").result Field 2: 0000-00-00.Please!
Vuong Mao
2010-08-12 07:19:32
`INSERT INTO customer ('name', 'DOB') VALUES ('$name', DATE_FORMAT($txtDOB,'%Y-%m-%d'))` OR `INSERT INTO customer ('name', 'DOB') VALUES ('$name', STR_TO_DATE($txtDOB,'%Y-%m-%d'))`
Prix
2010-08-12 07:31:09
i see! please! in Mysql format field 2: Dateif i do INSERT INTO customer ('name', 'DOB') VALUES ('$name', DATE_FORMAT($txtDOB,'%Y-%m-%d')). but i can't insert it.
Vuong Mao
2010-08-12 08:17:15
`or die mysql_error()` says what ?
Prix
2010-08-12 08:42:54