469,923 Members | 1,597 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,923 developers. It's quick & easy.

php "date()" function

When I used the "date("nj")" function to generate an invoice, about 1
out of 500 times, nothing comes up

<?php
$invoicedate = date("nj");
?>
<html><head></head><body>
Invoice date:
<?php
print $invoicedate;
?>
</body></html>

So, when I noticed some invoices were missing dates, I tried this:

<?php
$invoicedate = date("nj");
?>
<html><head></head><body>
Invoice date:
<?php
if (!invoicedate) {
$invoicedate = date("nj");
}
print $invoicedate;
?>
</body></html>

But, still, 1 out of 500 times, no date prints to browser.

My question is: On some web-servers, does the date() function not always
work? If not, then why not?

Jul 17 '05 #1
2 1998
"Westcoast Sheri" <sh*********@nospamun8nospam.com> wrote in message
news:40***************@nospamun8nospam.com...
When I used the "date("nj")" function to generate an invoice, about 1
out of 500 times, nothing comes up

<?php
$invoicedate = date("nj");
?>
<html><head></head><body>
Invoice date:
<?php
print $invoicedate;
?>
</body></html>

So, when I noticed some invoices were missing dates, I tried this:

<?php
$invoicedate = date("nj");
?>
<html><head></head><body>
Invoice date:
<?php
if (!invoicedate) {
$invoicedate = date("nj");
}
print $invoicedate;
?>
</body></html>

But, still, 1 out of 500 times, no date prints to browser.

My question is: On some web-servers, does the date() function not always
work? If not, then why not?


This won't completely answer your question, but one problem I did notice in
your second example was that you left out the dollar sign $ in the if
statement on line 7:

if (!invoicedate) {

should be

if (!$invoicedate) {

- JP
Jul 17 '05 #2
kingofkolt wrote:
"Westcoast Sheri" <sh*********@nospamun8nospam.com> wrote in message
news:40***************@nospamun8nospam.com...
When I used the "date("nj")" function to generate an invoice, about 1
out of 500 times, nothing comes up

<?php
$invoicedate = date("nj");
?>
<html><head></head><body>
Invoice date:
<?php
print $invoicedate;
?>
</body></html>

So, when I noticed some invoices were missing dates, I tried this:

<?php
$invoicedate = date("nj");
?>
<html><head></head><body>
Invoice date:
<?php
if (!invoicedate) {
$invoicedate = date("nj");
}
print $invoicedate;
?>
</body></html>

But, still, 1 out of 500 times, no date prints to browser.

My question is: On some web-servers, does the date() function not always
work? If not, then why not?


This won't completely answer your question, but one problem I did notice in
your second example was that you left out the dollar sign $ in the if
statement on line 7:

if (!invoicedate) {

should be

if (!$invoicedate) {

- JP


Oops, just a typo in this newsgroup only, not in script.
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Martien van Wanrooij | last post: by
11 posts views Thread by walterbyrd | last post: by
3 posts views Thread by davidfinance | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.