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
https://forums.phpfreaks.com/topic/214383-multiple-by-count-and-session-variable/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.