473,588 Members | 2,474 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Newbie Problem using if statement with &&

Hello all.

I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}

Ok when the code runs it and both conditions are true nothing happens.

Testing:

$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.

$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true

If i put these if statements on the page they both work fine.

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

Thanks in advance for any help
Jun 2 '08 #1
9 1465
John wrote:
Hello all.

I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}

Ok when the code runs it and both conditions are true nothing happens.

Testing:

$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.

$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true

If i put these if statements on the page they both work fine.

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

Thanks in advance for any help
When things like this fail, a good first step is to echo the values
involved.

For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird "]
and $rowWork["wEarlyBird "]? Are you getting what you think you should
be getting from date("Y-m-d")? Also - is $_REQUEST["frmIsEarlyBird "]
equal to "1" or 1? They are two different values.

Also, $_REQUEST is generally not a good thing to use, If it's coming
from a POSTed forum, use $_POST. If it's in the URL, use $_GET.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '08 #2
Yeah I have tested the vslues and they are valid. As i said in the
original post:
Testing:

$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.

$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true

If i put these if statements on the page they both work fine.
(validate as true)

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

On Jun 1, 4:42*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
John wrote:
Hello all.
I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:
if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}
Ok when the code runs it and both conditions are true nothing happens.
Testing:
$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true
If i put these if statements on the page they both work fine.
* * *if ($_REQUEST["frmIsEarlyBird "] == "1") {
* * * * * echo "<br><br>TRUE<b r><br>";
* * *} else {
* * * * * echo "<br><br>False< br><br>";
* * *}
* * *if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
* * * * * echo "<br><br>TRUE<b r><br>";
* * *} else {
* * * * * echo "<br><br>False< br><br>";
* * *}
Thanks in advance for any help

When things like this fail, a good first step is to echo the values
involved.

For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird "]
and $rowWork["wEarlyBird "]? *Are you getting what you think you should
be getting from date("Y-m-d")? *Also - is $_REQUEST["frmIsEarlyBird "]
equal to "1" or 1? *They are two different values.

Also, $_REQUEST is generally not a good thing to use, *If it's coming
from a POSTed forum, use $_POST. *If it's in the URL, use $_GET.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===- Hide quoted text -

- Show quoted text -
Jun 2 '08 #3
John wrote:
On Jun 1, 4:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>John wrote:
>>Hello all.
I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:
if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>Th e earlybird special has ended.</h1>");
}
Ok when the code runs it and both conditions are true nothing happens.
Testing:
$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true
If i put these if statements on the page they both work fine.
if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
Thanks in advance for any help
When things like this fail, a good first step is to echo the values
involved.

For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird "]
and $rowWork["wEarlyBird "]? Are you getting what you think you should
be getting from date("Y-m-d")? Also - is $_REQUEST["frmIsEarlyBird "]
equal to "1" or 1? They are two different values.

Also, $_REQUEST is generally not a good thing to use, If it's coming
from a POSTed forum, use $_POST. If it's in the URL, use $_GET.

--
============== ====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attg lobal.net
============== ====- Hide quoted text -

- Show quoted text -

Yeah I have tested the vslues and they are valid. As i said in the
original post:
Testing:

$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.

$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true

If i put these if statements on the page they both work fine.
(validate as true)

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
(Top posting fixed)

Well, obviously something is not as you describe, because '&&' has a
lower priority than either '==' or '<', which is why I asked you to
verify this. It's either the data or the statement you supplied doesn't
match what you have in your code. I'm just trying to eliminate
possibilities.

P.S. Please don't top post. Thanks.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 2 '08 #4
John wrote:
On Jun 1, 4:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>John wrote:
>>Hello all.
I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:
if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>Th e earlybird special has ended.</h1>");
}
Ok when the code runs it and both conditions are true nothing happens.
Testing:
$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true
If i put these if statements on the page they both work fine.
if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
Thanks in advance for any help
When things like this fail, a good first step is to echo the values
involved.

For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird "]
and $rowWork["wEarlyBird "]? Are you getting what you think you should
be getting from date("Y-m-d")? Also - is $_REQUEST["frmIsEarlyBird "]
equal to "1" or 1? They are two different values.

Also, $_REQUEST is generally not a good thing to use, If it's coming
from a POSTed forum, use $_POST. If it's in the URL, use $_GET.

--
============== ====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attg lobal.net
============== ====- Hide quoted text -

- Show quoted text -

Yeah I have tested the vslues and they are valid. As i said in the
original post:
Testing:

$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.

$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true

If i put these if statements on the page they both work fine.
(validate as true)

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
(Top posting fixed)

Well, obviously something is not as you describe, because '&&' has a
lower priority than either '==' or '<', which is why I asked you to
verify this. It's either the data or the statement you supplied doesn't
match what you have in your code. I'm just trying to eliminate
possibilities.

P.S. Please don't top post. Thanks.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
js*******@attgl obal.net
=============== ===
Jun 27 '08 #5
On Jun 1, 8:10*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
John wrote:
On Jun 1, 4:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
John wrote:
Hello all.
I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:
if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}
Ok when the code runs it and both conditions are true nothing happens.
Testing:
$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true
If i put these if statements on the page they both work fine.
* * *if ($_REQUEST["frmIsEarlyBird "] == "1") {
* * * * * echo "<br><br>TRUE<b r><br>";
* * *} else {
* * * * * echo "<br><br>False< br><br>";
* * *}
* * *if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
* * * * * echo "<br><br>TRUE<b r><br>";
* * *} else {
* * * * * echo "<br><br>False< br><br>";
* * *}
Thanks in advance for any help
When things like this fail, a good first step is to echo the values
involved.
For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird "]
and $rowWork["wEarlyBird "]? *Are you getting what you think you should
be getting from date("Y-m-d")? *Also - is $_REQUEST["frmIsEarlyBird "]
equal to "1" or 1? *They are two different values.
Also, $_REQUEST is generally not a good thing to use, *If it's coming
from a POSTed forum, use $_POST. *If it's in the URL, use $_GET.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===- Hide quoted text -
- Show quoted text -

*Yeah I have tested the vslues and they are valid. As i said in the
*original post:
*>
*>
*Testing:
*>
*$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
*string of 1 or 0 depending on what im sending.
*>
*$rowWork["wEarlyBird "] Has a valid date in it and should validate as
*true
*>
*If i put these if statements on the page they both work fine.
*(validate as true)
*>
** * *if ($_REQUEST["frmIsEarlyBird "] == "1") {
** * * * * echo "<br><br>TRUE<b r><br>";
** * *} else {
** * * * * echo "<br><br>False< br><br>";
** * *}
*>
** * *if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
** * * * * echo "<br><br>TRUE<b r><br>";
** * *} else {
** * * * * echo "<br><br>False< br><br>";
** * *}
*>

(Top posting fixed)

Well, obviously something is not as you describe, because '&&' has a
lower priority than either '==' or '<', which is why I asked you to
verify this. *It's either the data or the statement you supplied doesn't
match what you have in your code. *I'm just trying to eliminate
possibilities.

P.S. Please don't top post. *Thanks.

--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===- Hide quoted text -

- Show quoted text -
Sorry bout top posting im new to this group thing as well as php.
Thanks for trying to help me. the code below is an exact paste from
the page. I have the first two if statements there to test the
variables. When the code runs I see TRUE TRUE and thats it the die
never runs. It is my understanding that I am trying to say in my
statement that if $_REQUEST["frmIsEarlyBird "] == "1" is true AND
date("Y-m-d") < $rowWork["wEarlyBird "] is true run the die. I dont
understand why the first two if statetments would each display true
but the third not run.

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}
Jun 27 '08 #6
On Mon, 02 Jun 2008 06:30:51 +0200, John <Jo*********@gm ail.comwrote:
On Jun 1, 8:10*pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>John wrote:
On Jun 1, 4:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
John wrote:
Hello all.
I am a PHP newbie and am having an issue using the && in an if
statement. here is the code:
if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>Th e earlybird special has ended.</h1>");
}
Ok when the code runs it and both conditions are true nothing
happens.
>>Testing:
$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true
If i put these if statements on the page they both work fine.
* * *if ($_REQUEST["frmIsEarlyBird "] == "1") {
* * * * * echo "<br><br>TRUE<b r><br>";
* * *} else {
* * * * * echo "<br><br>False< br><br>";
* * *}
* * *if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
* * * * * echo "<br><br>TRUE<b r><br>";
* * *} else {
* * * * * echo "<br><br>False< br><br>";
* * *}
Thanks in advance for any help
When things like this fail, a good first step is to echo the values
involved.
>For instance, right now, what do you have in
$_REQUEST["frmIsEarlyBird "]
>and $rowWork["wEarlyBird "]? *Are you getting what you think you
should
>be getting from date("Y-m-d")? *Also - is $_REQUEST["frmIsEarlyBird "]
equal to "1" or 1? *They are two different values.
>Also, $_REQUEST is generally not a good thing to use, *If it's coming
from a POSTed forum, use $_POST. *If it's in the URL, use $_GET.
>--
============== ====
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attg lobal.net
============== ====- Hide quoted text -
>- Show quoted text -

*Yeah I have tested the vslues and they are valid. As i said in the
*original post:
*>
*>
*Testing:
*>
*$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
*string of 1 or 0 depending on what im sending.
*>
*$rowWork["wEarlyBird "] Has a valid date in it and should validate as
*true
*>
*If i put these if statements on the page they both work fine.
*(validate as true)
*>
** * *if ($_REQUEST["frmIsEarlyBird "] == "1") {
** * * * * echo "<br><br>TRUE<b r><br>";
** * *} else {
** * * * * echo "<br><br>False< br><br>";
** * *}
*>
** * *if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
** * * * * echo "<br><br>TRUE<b r><br>";
** * *} else {
** * * * * echo "<br><br>False< br><br>";
** * *}
*>

(Top posting fixed)

Well, obviously something is not as you describe, because '&&' has a
lower priority than either '==' or '<', which is why I asked you to
verify this. *It's either the data or the statement you supplied doesn't
match what you have in your code. *I'm just trying to eliminate
possibilitie s.

Sorry bout top posting im new to this group thing as well as php.
Thanks for trying to help me. the code below is an exact paste from
the page. I have the first two if statements there to test the
variables. When the code runs I see TRUE TRUE and thats it the die
never runs. It is my understanding that I am trying to say in my
statement that if $_REQUEST["frmIsEarlyBird "] == "1" is true AND
date("Y-m-d") < $rowWork["wEarlyBird "] is true run the die. I dont
understand why the first two if statetments would each display true
but the third not run.

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}
If that's the actual code, with nothing in between that can alter either
of the variables, I'm thoroughly puzzled. 100% sure you're not misspelling
one of the variable names? And have you enabled display_errors and set
error_reporting to E_ALL | E_STRICT ?
--
Rik Wasmus
....spamrun finished
Jun 27 '08 #7
John <Jo*********@gm ail.comwrote:
: I dont
: understand why the first two if statetments would each display true
: but the third not run.

: if ($_REQUEST["frmIsEarlyBird "] == "1") {
: echo "<br><br>TRUE<b r><br>";
: } else {
: echo "<br><br>False< br><br>";
: }

: if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
: echo "<br><br>TRUE<b r><br>";
: } else {
: echo "<br><br>False< br><br>";
: }

: if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
: $rowWork["wEarlyBird "]) {
: die("<h1>The earlybird special has ended.</h1>");
: }
What happens if you replace your last statement with this one?

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
echo 'hereiam<br/>';
}
--thelma
[with no real idea of what's going on]
Jun 27 '08 #8
On 2 Jun, 04:30, John <JohnMay1...@gm ail.comwrote:
On Jun 1, 8:10 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
John wrote:
On Jun 1, 4:42 pm, Jerry Stuckle <jstuck...@attg lobal.netwrote:
>John wrote:
>>Hello all.
>>I am a PHP newbie and am having an issue using the && in an if
>>statement. here is the code:
>>if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
>>$rowWork["wEarlyBird "]) {
>>die("<h1>Th e earlybird special has ended.</h1>");
>>}
>>Ok when the code runs it and both conditions are true nothing happens.
>>Testing:
>>$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
>>string of 1 or 0 depending on what im sending.
>>$rowWork["wEarlyBird "] Has a valid date in it and should validate as
>>true
>>If i put these if statements on the page they both work fine.
>> if ($_REQUEST["frmIsEarlyBird "] == "1") {
>> echo "<br><br>TRUE<b r><br>";
>> } else {
>> echo "<br><br>False< br><br>";
>> }
>> if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
>> echo "<br><br>TRUE<b r><br>";
>> } else {
>> echo "<br><br>False< br><br>";
>> }
>>Thanks in advance for any help
>When things like this fail, a good first step is to echo the values
>involved.
>For instance, right now, what do you have in $_REQUEST["frmIsEarlyBird "]
>and $rowWork["wEarlyBird "]? Are you getting what you think you should
>be getting from date("Y-m-d")? Also - is $_REQUEST["frmIsEarlyBird "]
>equal to "1" or 1? They are two different values.
>Also, $_REQUEST is generally not a good thing to use, If it's coming
>from a POSTed forum, use $_POST. If it's in the URL, use $_GET.
>--
>============== ====
>Remove the "x" from my email address
>Jerry Stuckle
>JDS Computer Training Corp.
>jstuck...@attg lobal.net
>============== ====- Hide quoted text -
>- Show quoted text -
Yeah I have tested the vslues and they are valid. As i said in the
original post:
>
>
Testing:
>
$_REQUEST["frmIsEarlyBird "] is a valid form request and returns a
string of 1 or 0 depending on what im sending.
>
$rowWork["wEarlyBird "] Has a valid date in it and should validate as
true
>
If i put these if statements on the page they both work fine.
(validate as true)
>
if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
>
if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}
>
(Top posting fixed)
Well, obviously something is not as you describe, because '&&' has a
lower priority than either '==' or '<', which is why I asked you to
verify this. It's either the data or the statement you supplied doesn't
match what you have in your code. I'm just trying to eliminate
possibilities.
P.S. Please don't top post. Thanks.
--
=============== ===
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstuck...@attgl obal.net
=============== ===- Hide quoted text -
- Show quoted text -

Sorry bout top posting im new to this group thing as well as php.
Thanks for trying to help me. the code below is an exact paste from
the page. I have the first two if statements there to test the
variables. When the code runs I see TRUE TRUE and thats it the die
never runs. It is my understanding that I am trying to say in my
statement that if $_REQUEST["frmIsEarlyBird "] == "1" is true AND
date("Y-m-d") < $rowWork["wEarlyBird "] is true run the die. I dont
understand why the first two if statetments would each display true
but the third not run.

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}
First a hint. Only use double quotes, if you want to perform variable
substitution within a string. Otherwise, try to use single quotes.

Now, when I get a problem like this, I tend to echo out all the values
and all the intermediate results. So please replace your code with
this and then post the output here:

echo 'frmIsEarlyBird ='.$_REQUEST['frmIsEarlyBird].'=<br />';
echo 'date='.date('Y-m-d').'=<br />';
echo 'wEarlyBird='.$ rowWork['wEarlyBird'].'=<br />';
echo '($_REQUEST["frmIsEarlyBird "] == \'1\')='.
($_REQUEST['frmIsEarlyBird '] == '1').'=<br />';
echo '(date(\'Y-m-d\') < $rowWork[\'wEarlyBird\'])='.(date(\'Y-m-d\')
< $rowWork[\'wEarlyBird\']).'=';
echo '&&='.($_REQUES T['frmIsEarlyBird '] == '1' && date(\'Y-m-d\') <
$rowWork[\'wEarlyBird\']).'=';
if ($_REQUEST['frmIsEarlyBird '] == '1' && date('Y-m-d') <
$rowWork['wEarlyBird']) {
die('<h1>The earlybird special has ended.</h1>');

}
Jun 27 '08 #9
On Sun, 1 Jun 2008 21:30:51 -0700 (PDT), John wrote:
Sorry bout top posting im new to this group thing as well as php.
Thanks for trying to help me. the code below is an exact paste from
the page. I have the first two if statements there to test the
variables. When the code runs I see TRUE TRUE and thats it the die
never runs. It is my understanding that I am trying to say in my
statement that if $_REQUEST["frmIsEarlyBird "] == "1" is true AND
date("Y-m-d") < $rowWork["wEarlyBird "] is true run the die. I dont
understand why the first two if statetments would each display true
but the third not run.

if ($_REQUEST["frmIsEarlyBird "] == "1") {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if (date("Y-m-d") < $rowWork["wEarlyBird "]) {
echo "<br><br>TRUE<b r><br>";
} else {
echo "<br><br>False< br><br>";
}

if ($_REQUEST["frmIsEarlyBird "] == "1" && date("Y-m-d") <
$rowWork["wEarlyBird "]) {
die("<h1>The earlybird special has ended.</h1>");
}
Are you 100% sure that this is a problem with the && operator and not a
problem with the fact that your < maybe should be a ? 'Cause that
LOOKS like it's testing that the current time is BEFORE the "wEarlyBird "
thing, not after it.

--
Any research done on how to efficiently use computers has been long lost
in the mad rush to upgrade systems to do things that aren't needed by
people who don't understand what they are really supposed to do with them.
-- Graham Reed
Jun 27 '08 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
2046
by: NotGiven | last post by:
session_start(); if (isset($HTTP_SESSION_VARS))&&($HTTP_SESSION_VARS != '') echo "hello"; It doesn't throw an error it just doesn't display anything However, this works: session_start(); if (isset($HTTP_SESSION_VARS))
3
7947
by: Bryan | last post by:
I am executing a case statement list below, USE Northwind SELECT MONTH(OrderDate) AS OrderMonth, SUM(CASE YEAR(OrderDate) WHEN 1996 THEN 1 ELSE 0 END) AS c1996,
5
1755
by: Michael Hill | last post by:
I have a general question about how people generally tend to deal with users data that they enter. As an example users enter double quotes in a text field surrounding a specific piece of text they want to hi-lite and then it barfs during the oracle insert step because the string is not properly delimited. Another example is where the ampersand causes trouble when used on an xml page so provisions are made to insert it into the table...
1
1432
by: charles | last post by:
when i read the notable book of inside the c++ bject model ,i was confused by the chapter 3.3. i was confused by the statement as follow: chaper 3.3: Given the following pair of program statements: Point3d origin; .....Access of a nonstatic data member requires the addition of the beginningaddress of the class object with the offset location of the data member.For example, givenorigin._y = 0.0; the address of&origin._y; is equivalent...
15
2953
by: sara | last post by:
Hi I'm pretty new to Access here (using Access 2000), and appreciate the help and instruction. I gave myself 2.5 hours to research online and help and try to get this one, and I am not getting it. Simple database: I want to have a user enter Supply Orders (just for tracking purposes) by Item. The user may also enter a new item - "new" is a combination of Item, PartNumber and Vendor - they could have the
1
7143
by: chis2k | last post by:
How can I compare objects in a switch statement? For instance: public void textbox1_Select(object sender, System.Eventargs e) { Textbox tx = (TextBox)sender; switch (tx) { case textbox2: /*something*/ break; case textbox3: /*something*/ break; } }
30
3170
by: James Daughtry | last post by:
char array; scanf("%19s", &array); I know this is wrong because it's a type mismatch, where scanf expects a pointer to char and gets a pointer to an array of 20 char. I know that question 6.12 of the C FAQ says that it's wrong for that very reason. What I don't know is where the standard tells me conclusively that it's wrong. What I also don't know is somewhere that this type mismatch will break in practice.
3
1822
by: Fred Chateau | last post by:
To catch an exception associated with resources within a Using block, does the Catch block go within the scope of the Using block or following it? If within the scope of the Using block, what about nested Using statements? Will a Catch block in the innermost Using block catch all exceptions? -- Regards, Fred Chateau
0
7862
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8357
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7987
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8223
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5729
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5398
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3847
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2372
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1459
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.