Some times not saving date time buy
I am inserting date and time, but storing 0000-00-00 00:00:00

Here is the code
<?php
include("connect_mysql.php");
$date=date("Y-m-s H:i:s");
mysql_query("insert into buy_db (from_site, date_time_buy, model, ip) values ('".$_REQUEST."', '$date','".$_REQUEST."', '".$_REQUEST."')");
//header('Location:'.$_REQUEST);
?>

Attachment including:
1. Data in Table
2. Table Structure

just try this:
mysql_query("insert into buy_db (from_site, date_time_buy, model, ip) values ('".$_REQUEST."', '".$date."','".$_REQUEST."', '".$_REQUEST."')");

If data type is timestamp it will automatically take current datetime.
You don't need to add it in insert query.

<?php
include("connect_mysql.php");
$date=date("Y-m-s H:i:s");
mysql_query("insert into buy_db (from_site, model, ip) values ('".$_REQUEST['site']."', '".$_REQUEST['model']."', '".$_REQUEST['ip']."')");
//header('Location:'.$_REQUEST['url']);
?>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.