"greater than or equal" code?

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

"greater than or equal" code?

Post by thefreebielife »

is there a code that would make this work:

Code: Select all

<? if ($count2 >= $gref && $ostatus == 1 && $count4 == 0) { echo "<div align=center><font color=#009900>Congrats!  You Are Ready To Order Your Free Gift. </font><font color=red><a href=\"order.php\"> Click To Order</a></font><Br>Make Sure Your Information Is Correct Before Ordering.  It Cannot Be Changed</div>"; } ?>
if the ostatus value could be 1 or greater than 1 for multiple users?

thanks in advance
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

$count2 >= $gref
$count2 is equal or greater than $gref
...what was the question again?
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

well say ostatus was 1.02.. then it would throw that off right?
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

Yes, but you should already know how to perform a greater-or-equal test ...it's already in your code.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

im support for the site, i didnt write the code and know little about php.

can someone help?
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

i did this already:

Code: Select all

($count2 >= $gref && $ostatus >= 1 && $count4 == 0)
But if the user's ostatus is 1 but their referrals is 1.02 it still doesnt work
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

hm,

Code: Select all

$count2 = $gref = 1;
$ostatus = 1.02;
$count4 = 0;


if ($count2 >= $gref && $ostatus >= 1 && $count4 == 0) {
	echo 'true';
}
else {
	echo 'false';
}
my php prints true as expected.
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

but this is the confusing part: this code can be true even if ostatus OR gref are 1 or 1.02
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

thefreebielife wrote:this code can be true even if ostatus OR gref are 1 or 1.02
You want it that way?
The condition is: $ostatus OR $gref greater-or-equal 1 ?
thefreebielife
Forum Contributor
Posts: 126
Joined: Thu Apr 26, 2007 2:59 pm

Post by thefreebielife »

i figured out the problem.

it was a different part of the code.

sorry but thanks for helping!

:)
Post Reply