Hey everyone,
I'm new to the forums, but not quite new to PHP...Except it feels like I'm a COMPLETE n00b. I have quite an interesting problem here.. I'll try to explain it in as much depth as I can without it being too confusing.
I'm developing an online game and I'm trying to get a progress bar that updates based on what a user's experience points are. I have a table called "levels" setup which is setup so that auto-increment "id" column is the actual level the user can obtain. In this table, I have levels_minfans and levels_maxfans. The rows inserted into this table look something like this:
levels_id: 1
levels_minfans: 0
levels_maxfans: 74
levels_id: 2
levels_minfans: 75
levels_maxfans: 149
levels_id: 3
levels_minfans: 150
levels_maxfans: 299
Now, what happens is if the user has anywhere between 0 and 74 fans, he is at level 1. When they hit 75 fans up to 149 fans, they are level 2 and so on. Well, I'm trying to get my static progress bar to display the percentage between these two values. Such as if they are level three, I need it so that the progress bar is at zero when they have 150 fans, and increment up to 100 as they hit 299 fans. So, in short, 150 fans really equals zero percent, and 299 fans equals 100 percent.
I think that might be in depth enough to understand the problem. I've been dealing with this crap ALL day today and no matter what combination of math formulas I try, I can't seem to get the progress bar to reset at zero everytime a new level is hit and the player has the minimum number of fans for that level and then top out at 100 when they reach the max fans for that level.
Does all of this make sense?
If so, I'd appreciate any help I can get from you guys. Thank you so much for reading this - hope I can get an answer soon!
Ricky