/    Sign up×
Community /Pin to ProfileBookmark

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 ..

to post a comment
PHP

7 Comments(s)

Copy linkTweet thisAlerts:
@ltingauthorJan 12.2004 — the date format is my sql table is


YEAR/Month/Day also

2004-01-12 ...
Copy linkTweet thisAlerts:
@pyroJan 12.2004 — For extensibility, might I recommend entereing the dates in a timestamp, and doing your formatting on the way [i]out[/i] of the DB...
Copy linkTweet thisAlerts:
@ltingauthorJan 12.2004 — 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
Copy linkTweet thisAlerts:
@pyroJan 12.2004 — Yes, you should be able to do so by changing your query to something like this:

[code=php]$updateCurrency = "UPDATE currencyrate SET currencyid = '$currencyid', currencyname = '$currencyname', exchangerate = '$exchangerate', lastupdate= ".date('Y-m-d')." WHERE pkey = '$pkey';";[/code]
Copy linkTweet thisAlerts:
@ltingauthorJan 12.2004 — emm not working ...

???
Copy linkTweet thisAlerts:
@pyroJan 12.2004 — Any error messages?
Copy linkTweet thisAlerts:
@ltingauthorJan 13.2004 — no error message

just it can't save into database ..

don't know what's wrong ..
×

Success!

Help @lting spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...