Welcome to Dream.In.Code
Getting PHP Help is Easy!

Join 132,461 PHP Programmers for FREE! Get instant access to thousands of PHP experts, tutorials, code snippets, and more! There are 1,374 people online right now. Registration is fast and FREE... Join Now!




New Greater Than

2 Pages V  1 2 >  
Reply to this topicStart new topic

New Greater Than

SpaceMan
post 28 Feb, 2005 - 12:52 PM
Post #1


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

i got most it t work, but one does not. baffeled. tryed so many things.
2 work, one does not.

works,
$Adult_Tickets == $Adult_coupons
$Adult_Tickets < $Adult_coupons

but the other one, have tryed greater, lesser, nothing seems to make a difference.
$Adult_coupons < $Adult_Tickets
also tryed,
$Adult_Tickets > $Adult_coupons

just need it to change the display,
if $Adult_coupons == $Adult_Tickets
display no options to add coupons
if $Adult_coupons < $Adult_Tickets
display options to add coupons
if $Adult_coupons > $Adult_Tickets
dispaly error


CODE

    if ($iteminfo[title] == "Adult Ticket" && $incart[quantity][$i] > "0" ){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $at;
   for($at = 1; $at < $incart[quantity][$i]+1; $at++)
$Adult_Tickets[] =  $Adult_Ticket['.$at.'];
$get_coupons .=  "Adult_Ticket? $Adult_Tickets<br>";
}

    if ($iteminfo[title] == "Adult Coupon" && $incart[quantity][$i] > "0" ){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac;
   for($ac = 1; $ac < $incart[quantity][$i]+1; $ac++)
$Adult_coupons[] =  $Adult_coupon['.$ac.'];
$get_coupons .=  "Adult_coupons? $Adult_coupons<br>";
}

if ($Adult_Tickets == $Adult_coupons){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
 $get_coupons .=  "Adult_Tickets = Adult_coupons<br>";
} elseif ($Adult_Tickets < $Adult_coupons){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
 $get_coupons .=  "Adult_Tickets < Adult_coupons<br>";
} else {
if ($Adult_coupons < $Adult_Tickets){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
 $get_coupons .=  "Adult_coupons < Adult_Tickets<br>";
}}


This post has been edited by SpaceMan: 28 Feb, 2005 - 12:57 PM
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 28 Feb, 2005 - 01:21 PM
Post #2


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


echo the values of $Adult_Coupon and $Adult_Ticket to the screen...what are they?
User is online!Profile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 01:27 PM
Post #3


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

QUOTE(Amadeus @ Feb 28 2005, 02:21 PM)
echo the values of $Adult_Coupon and $Adult_Ticket to the screen...what are they?

depends how many in the cart.

if 2 tickets looks like,
$Adult_Tickets[2]
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 28 Feb, 2005 - 01:31 PM
Post #4


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


but the values of $Adult_Coupon and $Adult_Ticket are numbers, right? their values are not being modified somewhere?
User is online!Profile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 01:34 PM
Post #5


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

QUOTE(Amadeus @ Feb 28 2005, 02:31 PM)
but the values of $Adult_Coupon and $Adult_Ticket are numbers, right? their values are not being modified somewhere?

i did just change,

for($at = 1; $at < $incart[quantity][$i]+1; $at++)
$Adult_Tickets = "$at";

display only the number, if 2 in cart, dispalys 2
does same thing, 2 work, one does not.



as far as i know , no modifaction of the numbers.
is not much to this funtion, you see most of it.
starts out,

parsecart();
for ($i = 0; $i < $cart[total_items]; $i++) {
$thisid = $incart[items][$i];
$quantity[$i] = $incart[quantity][$i];
$iteminfo = iteminfo($thisid);

i did at for adult ticket, and ac for adult coupon to keep them for getting confused else were.

This post has been edited by SpaceMan: 28 Feb, 2005 - 01:38 PM
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 28 Feb, 2005 - 01:53 PM
Post #6


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


Try
CODE

$Adult_Tickets += $at;
User is online!Profile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 02:30 PM
Post #7


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

QUOTE(Amadeus @ Feb 28 2005, 02:53 PM)
Try
CODE

$Adult_Tickets += $at;

displays different number then actually in the cart,
wich is ok as long as the comparison between the 2 works,

but same results.
User is offlineProfile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 02:33 PM
Post #8


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

it is dispalying the correct numbers,

but why this work,
if ($Adult_Tickets < $Adult_coupons){

and this one not?
if ($Adult_Tickets > $Adult_coupons){
User is offlineProfile CardPM

Go to the top of the page

Amadeus
post 28 Feb, 2005 - 03:28 PM
Post #9


g++ -o drink whiskey.cpp

Group Icon
Joined: 12 Jul, 2002
Posts: 12,173



Thanked 33 times

Dream Kudos: 25
My Contributions


Hmm...there does not seem to be a problem with the syntax...but I've relooked at your code again from up top, and you don't actually need that if statement at all...it is the only reamaining condition, so you should just be able to use the else.

CODE

if ($Adult_Tickets == $Adult_coupons){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
$get_coupons .=  "Adult_Tickets = Adult_coupons<br>";
} elseif ($Adult_Tickets < $Adult_coupons){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
$get_coupons .=  "Adult_Tickets < Adult_coupons<br>";
} else {
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
$get_coupons .=  "Adult_coupons < Adult_Tickets<br>";
}

Try that.

And my apologies from before, the earlier line of code I gave you should have read
CODE

$Adult_Tickets = $at;
User is online!Profile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 04:04 PM
Post #10


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

QUOTE(Amadeus @ Feb 28 2005, 04:28 PM)
Hmm...there does not seem to be a problem with the syntax...but I've relooked at your code again from up top, and you don't actually need that if statement at all...it is the only reamaining condition, so you should just be able to use the else.

CODE

if ($Adult_Tickets == $Adult_coupons){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
$get_coupons .=  "Adult_Tickets = Adult_coupons<br>";
} elseif ($Adult_Tickets < $Adult_coupons){
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
$get_coupons .=  "Adult_Tickets < Adult_coupons<br>";
} else {
global $Adult_Ticket, $get_coupons, $incart, $Adult_Tickets, $Adult_coupons, $Adult_coupon, $ac, $at;
$get_coupons .=  "Adult_coupons < Adult_Tickets<br>";
}

Try that.

And my apologies from before, the earlier line of code I gave you should have read
CODE

$Adult_Tickets = $at;

i thot the else would do it also, but dispalyed anyway.
so tryed adding the if inside it, still dispays it if any tickets in the cart.

but have made otehr changes, will try it again.


i did change it to $Adult_Tickets = $at;
from $Adult_Tickets = "$at";
no difference it seems.
User is offlineProfile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 04:22 PM
Post #11


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

same resuslts. confoundant thing.
i thot maybe is in the first loop, seeing a value, so added
$Adult_Tickets = "";
and
$Adult_coupons = "";
and a few variations of.
at the top, no sucsses
User is offlineProfile CardPM

Go to the top of the page

SpaceMan
post 28 Feb, 2005 - 04:45 PM
Post #12


D.I.C Regular

Group Icon
Joined: 20 Feb, 2003
Posts: 270

could not get that to work, so trying to subtract it, still displays all tickets.

$Adult_coupons_Adult_Tickets = $Adult_Tickets - $Adult_coupons;
for($ui = 0; $ui < $Adult_coupons_Adult_Tickets; $ui++)
$get_coupons .= '<option value="' . $ui . '">' . $ui . '</option>';


hmm, no bit top circus coupons for you, but i like lions and elaphants as long as i dont have to feed them.
User is offlineProfile CardPM

Go to the top of the page

2 Pages V  1 2 >
Fast ReplyReply to this topicStart new topic
Time is now: 11/22/08 12:41PM

Live PHP Help!

PHP Tutorials

Reference Sheets

PHP Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month