/    Sign up×
Community /Pin to ProfileBookmark

simple date problem (migrate from PHP4 to PHP5)

for some reason this isn’t adding the date into the database when a job is set as invoiced. it worked on the old PHP4 setup but since i’ve moved the server to PHP5 its remaining as the default value (0000-00-00) but the invoiced field is still being set to 1

[code=php]
$date = date(Y-m-d);
$query = “UPDATE `jobs` SET invoiced=’1′, date_invoiced=’$date’ WHERE job_no=’$job_no'”;
$this->execute($query);
[/code]

[CODE]
field name type default value
date_invoiced date 0000-00-00
[/CODE]

am i formatting the date wrong as i had a similar problem with dates when i didn’t include the “-” separator in another section of the system. :S

to post a comment
PHP

2 Comments(s)

Copy linkTweet thisAlerts:
@salmanshafiqSep 11.2007 — Use this

[code=php]
$date = date("Y-m-d");
$query = "UPDATE jobs SET invoiced='1', date_invoiced='$date' WHERE job_no='$job_no'";
$this->execute($query);
[/code]


if any further problem then tell me
Copy linkTweet thisAlerts:
@knowjauthorSep 11.2007 — ah. armature mistake.

thanks for the help
×

Success!

Help @knowj 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.28,
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,
)...