/    Sign up×
Community /Pin to ProfileBookmark

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?

to post a comment
PHP

6 Comments(s)

Copy linkTweet thisAlerts:
@pyroNov 27.2003 — Not sure what you are looking for, but here's the logic:

[code=php]<?PHP
$num = 3/5*100;
echo $num."%";
?>[/code]
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzNov 27.2003 — 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....
Copy linkTweet thisAlerts:
@pyroNov 27.2003 — What I posted works fine, and could be swapped out for variables very easily...
Copy linkTweet thisAlerts:
@Sux0rZh_jc0rzNov 27.2003 — 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.
Copy linkTweet thisAlerts:
@pyroNov 27.2003 — numba_one, if you show us more code than what you did, perhaps we can help you further...
×

Success!

Help @numba_one spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...