Click to See Complete Forum and Search --> : add date?
lting
01-11-2004, 09:12 PM
what is the php command to add today's date into my mysql database?
i try
$updateCurrency = "UPDATE currencyrate SET currencyid='$currencyid', currencyname='$currencyname', exchangerate='$exchangerate', lastupdate=date('Y-m-d') WHERE pkey = ".$pkey;
but it not working ..
the type of date inside my mysql table is DATE not varchar ..
lting
01-11-2004, 09:13 PM
the date format is my sql table is
YEAR/Month/Day also
2004-01-12 ...
For extensibility, might I recommend entereing the dates in a timestamp, and doing your formatting on the way out of the DB...
lting
01-11-2004, 09:51 PM
emmm
but the database had been created ... if i want to remain unchange on the database .. is it any possible way to do that?
emm but your suggestion is good .. i should tell my team members .. but currently i hope can remain unchange on the database
Yes, you should be able to do so by changing your query to something like this:
$updateCurrency = "UPDATE `currencyrate` SET `currencyid` = '$currencyid', `currencyname` = '$currencyname', `exchangerate` = '$exchangerate', `lastupdate`= ".date('Y-m-d')." WHERE `pkey` = '$pkey';";
lting
01-11-2004, 10:10 PM
emm not working ...
???
lting
01-12-2004, 06:59 PM
no error message
just it can't save into database ..
don't know what's wrong ..