News:

Please note these forums are mostly a testing ground for my SMF work and I don't really use them otherwise.

Main Menu

Paste-1324606230:v:use_geshi-0:v:type-php

Started by Guest, Dec 23, 2011, 02:10 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Guest

$array1 = array(1,2,3,4,5,6,7)

$choices = "1,3,5,2,3,4,3,2,7,4,2,1,4,5,3,4,2,1,3,3";

item "1" in array one appeared in $choices 2 times
item "2" in array one appeared in $choices 4 times
item "3" in array one appeared in $choices 6 times
item "4" in array one appeared in $choices 3 times
item "5" in array one appeared in $choices 2 times
item "6" in array one appeared in $choices 0 times
item "7" in array one appeared in $choices 1 times

Then print the results as follows:

Item "1": 2 - 11%
Item "2": 4 - 22%
Item "3": 6 - 33%
Item "4": 3 - 16%
Item "5": 2 - 11%
Item "7": 1 - 6%

Notice that Item "6" is not in the display, since it has no votes/selections

asdfasdf

$array1 = array(1,2,3,4,5,6,7)

$choices = "1,3,5,2,3,4,3,2,7,4,2,1,4,5,3,4,2,1,3,3";

item "1" in array one appeared in $choices 2 times
item "2" in array one appeared in $choices 4 times
item "3" in array one appeared in $choices 6 times
item "4" in array one appeared in $choices 3 times
item "5" in array one appeared in $choices 2 times
item "6" in array one appeared in $choices 0 times
item "7" in array one appeared in $choices 1 times

Then print the results as follows:

Item "1": 2 - 11%
Item "2": 4 - 22%
Item "3": 6 - 33%
Item "4": 3 - 16%
Item "5": 2 - 11%
Item "7": 1 - 6%

Notice that Item "6" is not in the display, since it has no votes/selections

--------------------------------------
$mstrreas1=mysql_query("
   SELECT id, reason
   FROM CONFIG_cxreasons
   ");

while($mstrreastmp1=mysql_fetch_array($mstrreas1)){
   list($mid,$mreason)=$mstrreastmp1;
   foreach($reasonlist as $key=>$indreason){
      if($mreason=="$indreason"){
      $mreason$mid++;$reasontotal++;
   }
}