Jump to content

Help with DATE storage


inther

Recommended Posts

I'm trying to use the date function to get it passed to a variable within a function that is in a class.  Then a mysql query stores it in the database. The function inserts data into the database as below;

 

$app_date is declared as a variable in the class

 

var $app_date;

 

Then in the function that inserts data into the database, the variable $app_date receives the current date

 

$app_date = date("Y-M-D");

 

Then within the same function, i use the variable $app_date  to insert the date into the database

 

$query = "INSERT INTO tablename

(app_date,)

VALUES  ('$app_date')";

 

mysql_query($query) or die(mysql_error());

 

but then when i check the database, all i see in the field is "0000-00-00"

 

How can i get the current date to be passed to the given variable in the php function and then stored into Mysql?

Link to comment
https://forums.phpfreaks.com/topic/185940-help-with-date-storage/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.