0

Can someone please help:(. I have a database with a field Date. I made the datatype to Date. But when I code the date in php I use the date() function to get the current date it donesn't want to insert in the database. Please help.

For example my code.

$name = $_POST['name'];
$date = date("yyyy,mm,dd");

insert into tablename ('name','date') values ('{$name}','{$date}');

Edited by nav33n: Use [code] tags to wrap your code for easy readability.

3
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by network18
0

Can someone please help:(. I have a database with a field Date. I made the datatype to Date. But when I code the date in php I use the date() function to get the current date it dones want to insert in the database. Please help.

For example my code.

$name = $_POST;
$date = date("yyyy,mm,dd");

insert into tablename ('name','date') values ('{$name}','{$date}');

no need of date field
just copy like this.

insert into tablename ('name','date') values ('{$name}',now());

take date in datebase

0

Can someone please help:(. I have a database with a field Date. I made the datatype to Date. But when I code the date in php I use the date() function to get the current date it donesn't want to insert in the database. Please help.

For example my code.

$name = $_POST;
$date = date("yyyy,mm,dd");

insert into tablename ('name','date') values ('{$name}','{$date}');

use it this way -

date('Y,m,d');
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.