JackJack Posted April 19, 2006 Share Posted April 19, 2006 When i insert a new table in mysql i put the date as $date.[code]mysql_query("INSERT INTO `company_news` (date, sender, title, message, company)VALUES ('$date', 'Updater', 'Company Name Updated', 'Your companys name has been updated to $name.', '$name')");[/code] When i look at what has been added the date is always "0000-00-00 00:00:00".Please helpJJ Quote Link to comment Share on other sites More sharing options...
wisewood Posted April 19, 2006 Share Posted April 19, 2006 instead of using $date as the value to insert, use NOW().This will generate a properly formatted date/time stamp for you...or at least it does with my setup.[code]mysql_query("INSERT INTO `company_news` (date, sender, title, message, company)VALUES ('NOW()', 'Updater', 'Company Name Updated', 'Your companys name has been updated to $name.', '$name')");[/code] Quote Link to comment Share on other sites More sharing options...
reaper7861 Posted April 19, 2006 Share Posted April 19, 2006 also what is your declaration for date $date=? cause you can also declare it look here [a href=\"http://us3.php.net/manual/en/ref.datetime.php\" target=\"_blank\"]http://us3.php.net/manual/en/ref.datetime.php[/a]or[a href=\"http://us3.php.net/manual/en/function.date.php\" target=\"_blank\"]http://us3.php.net/manual/en/function.date.php[/a]hope that helps, have a good day.GCT Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.