Click to See Complete Forum and Search --> : Help!!
numba_one
11-26-2003, 08:28 PM
ok what im trying to do is get a percentage here.... heres the script im going off of:
$percentage = ($recruits / $num_mems) * 100;
and when i put $percentage down where i want it to show it just shows a zero.....when i put $recruits or $num_mems it shows the correct number for those 2 categories but when i try to get a percentage out of them it dosnt work...any help?
Not sure what you are looking for, but here's the logic:
<?PHP
$num = 3/5*100;
echo $num."%";
?>
Sux0rZh@jc0rz
11-26-2003, 11:39 PM
pyro... he has like a page with 2 variable numbers..
$num1
$num2
and wants to find the percentage..
$percentage = ($num1 / $num2) * 100
and then obviously echo it with echo $percentage . "%"
but it doesnt work for him... that's what he is saying.. do you know WHY it wouldnt work? cause it should....
What I posted works fine, and could be swapped out for variables very easily...
Sux0rZh@jc0rz
11-27-2003, 01:05 AM
i know that pyro...:rolleyes:
what he is saying is he is swapping out the variables and it stops working for him. so he is asking if he if swapping it out wrong by doing
$percentage ($blah / $blah) * 100;
but what i said is no.. it should work for u and i have no clue why that does not work the gods hate you blah.
numba_one
11-27-2003, 08:35 AM
:(
numba_one, if you show us more code than what you did, perhaps we can help you further...