I have an insert script with mySQL. I need to place the date and time when the record is created in the 'add_time" column.
Can anyone show me how to modify my existing script to do this? Do I need a separate PHP script?
I would like the date to appear in standard formt: 09/25/11 6:54 AM
<?
$host="XXXXXXXXXXX";
$username="XXXXXXX";
$password="XXXXXXX";
$db_name="naturan8_hero";
$tbl_name="cartons_added";
mysql_connect("$host", "$username", "$password") or die("cannot connect");
mysql_select_db("$db_name")or die("cannot select DB");
$order = "INSERT INTO cartons_added (
type,
part_no,
add_type,
add_qty,
add_ref,
add_by,
add_notes
) VALUES (
'$_POST[type]',
'$_POST[part_no]',
'$_POST[add_type]',
'$_POST[add_qty]',
'$_POST[add_ref]',
'$_POST[add_by]',
'$_POST[add_notes]'
)";
$result = mysql_query($order);
if ($result) {
$part_no = $_REQUEST['part_no'] ;
$add_qty = $_REQUEST['add_qty'];
header("location: inv_fc_add_success.php?part_no=" . urlencode($part_no) . "&add_qty=" . urlencode($add_qty));
}
else {
header("location: inv_fc_add_fail.php");
}
?>