Knowledgebase

[PHP] Process bar

Posted by Danny159, 07-21-2008, 03:19 PM
Hey, I need a process bar like the following images... http://www.peergoal.com/scripts/quic...cripts.com-QPM Where it gets like 35 from the database and shows 30% of a 100% shaded or a colour (eg green) I cant seem to do it, can someone post a link to something like this or post an eg code or one that i can use? Danny

Posted by Steve_Arm, 07-21-2008, 03:27 PM
The most easiest way is 2 divs, one the background 100px wide. The other inside it as many pixels as the percentage value. Do you have a problem calculating the percentage?

Posted by The Universes, 07-21-2008, 03:59 PM
If you want it as an image, use GD http://img530.imageshack.us/img530/6018/testiv3.png

Posted by Danny159, 07-21-2008, 04:51 PM
I did it with div's as i dont know about the GD thing... One thing my code sould work out 250-30% witch would = 75 but it says its 220... Why is that?

Posted by The Universes, 07-21-2008, 04:54 PM
Do you mean $calc = ceil(250*$per)?

Posted by Danny159, 07-21-2008, 04:58 PM
No as that = 7500 not 75 it sould be 250 - 30% witch would = 75 but it doesnt it ='s 220

Posted by Dan L, 07-21-2008, 05:01 PM
ceil(250 * .7);

Posted by Danny159, 07-21-2008, 05:04 PM
Nope... Danny

Posted by Harzem, 07-21-2008, 05:08 PM
Ough, 250 - 30% is only equal to 75 on hand calculators, not PHP. Your code is nonsense, but curable

Posted by Danny159, 07-21-2008, 07:11 PM
Works thanks

Posted by Danny159, 07-22-2008, 03:44 AM
How do you make the take rows alternit colours... like top is drak gray and then below that is white and below the white one its light gray then under that white and so on...



Was this answer helpful?

Add to Favourites Add to Favourites

Print this Article Print this Article

Also Read
PHP Help (Views: 597)


Language:

Client Login

Email

Password

Remember Me

Search