# Thread: Using less than, greater than to perform a calculation

1. ## Using less than, greater than to perform a calculation

I'm selling greeting cards. The price is based on how many cards the user orders. The calculations that I'm using currently do not calculate the correct price. Here's how it works now:

PHP Code:
``` \$price1 = "1.00"; \$price2 = "1.25"; if (\$quantity < 25) {      echo("The minimum order is 25 cards."); } if (\$quantity < 75) {      \$price = \$price1*(\$quantity); } if (\$quantity < 100) {      \$price = \$price2*(\$quantity);  ```
So if the user enters an quantity of 70 cards, both if statements are true. How do I code the statement: "If quantity is less than 75 and greater than 24 then the price will equal X"?

-- Coffee and SitePoint.com are the keys to a great site!

Thanks!

-- asterikx

2. Try this:
PHP Code:
``` if (\$quantity > 24 && \$quantity < 75) {      \$price = \$price1*(\$quantity); }  ```

3. And i think this will also work with the word "AND"
PHP Code:
``` if (\$quantity > 24 AND \$quantity < 75) {      \$price = \$price1*(\$quantity); }  ```

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•