I am import csv file in mysql database without the date format.but i have to insert current data and time in separate column.how can I implement the code to store the date and time.
php code:
include_once("includes/dbConnection.php");
session_start();
if(!isset($_SESSION['u_id']))
{
header("Location:membership_import_csvpage.php");
}
//$deleterecords = "TRUNCATE TABLE contacts";
//empty the table of its current records
//mysql_query($deleterecords);
if ($_FILES[csv][size] > 0) {
$file = $_FILES[csv][tmp_name];
$handle = fopen($file,"r");
$date = date('Y-m-d');
do {
if ($data[0]) {
mysql_query("INSERT INTO membership (mbid, name,identification_number,date,user_id) VALUES
(
'".addslashes($data[0])."',
'".addslashes($data[1])."',
'".addslashes($data[2])."',
'".addslashes($data ['CURDATE()'])."',
'".addslashes($_SESSION['u_id'])."'
) ");
}
} while ($data = fgetcsv($handle,1000,",","'"));
//
//redirect
echo ("<SCRIPT LANGUAGE='JavaScript'>
window.alert('import csv Updated successfully')
window.location.href='membership_import_csvpage.php';
</SCRIPT>");
die;
}
?>