Click to See Complete Forum and Search --> : insert date with now()


mrtme
01-03-2007, 12:27 AM
I'm trying to insert the current date with the now() function, this is the insert with fields, i'm a bit lost as to how this would work, can anyone help a clueless newbie?

$sql="INSERT INTO links (name, country, city, address, rating, size, date)
VALUES
('$_POST[name]','$_POST[country]','$_POST[city]','$_POST[address]','$_POST[rating]','$_POST[size]')";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>

chazzy
01-03-2007, 08:03 AM
should be..


$sql="INSERT INTO links (name, country, city, address, rating, size, date)
VALUES
('$_POST[name]','$_POST[country]','$_POST[city]','$_POST[address]','$_POST[rating]','$_POST[size]',NOW())";
if (!mysql_query($sql,$con))
{
die('Error: ' . mysql_error());
}
echo "1 record added";
mysql_close($con)
?>