Jump to content

Multiple by Count and Session Variable


billhobbs

Recommended Posts

I'm not sure how to approach this but here is my problem.

 

I'm using a sql statement that counts the number of users in the database. I've created a session variable named $MerchantCount and then I need to multiple that number by this scheme

 

0-9  Needs to multiple by 2.5

10-19 Needs to multiple by 5.0

20 and up needs to multiple by 7.5

 

How would I do this? Thanks...

Link to comment
Share on other sites

So you are counting the number of users, and then wanting to muliply by a preset number.

 

This can be done the following way, may not be the shortest method though...

<?php
  if($MerchantCount <= '9') {
    $mutliplier = '2.5';
  } else if($MerchantCount > '9' && $MerchantCount <= '19') {
    $mutliplier = '5.0';
  } else {
    $mutliplier = '7.5';
  }

  echo $mutliplier;
?>

 

Then you can use $mulitplier to do any calculation you need to and it will be within your scheme.

 

Tell me how it goes bud.

 

Regards, Paul.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.