Current location: Hot Scripts Forums » Programming Languages » ASP » Graphical display for numbers like casino chips


Graphical display for numbers like casino chips

Reply
  #1 (permalink)  
Old 07-27-06, 10:04 AM
rcpilotp51 rcpilotp51 is offline
New Member
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Graphical display for numbers like casino chips

I have 9 gif images (1,2,3,4,5,10,20,50,100).

i have a profile section on my website. At work a bunch of us play basketball. and i wanted to keep track of each persons wins.

Using asp and a access database where i could just add a field to their profile...I want to do the following

Say "joe" has 139 wins...instead of displaying 139 i want to display a combination if the 9 images above (each image is different colored basketballs- 1-4 are clusters of the same color, 5,10,20,50 and 100 are individual basketballs of different colors)

So then 139 would then display as

100,20,10,5,4 -adding up to 139

Does anyone know the algorithm fo doing something like this, or even an asp code snippet.

thanks
Keith
Reply With Quote
  #2 (permalink)  
Old 09-18-06, 10:48 AM
GO4TF4CE's Avatar
GO4TF4CE GO4TF4CE is offline
Wannabe Coder
 
Join Date: Apr 2004
Posts: 223
Thanks: 0
Thanked 0 Times in 0 Posts
Talking

heres a basic example of what I would do, I would normally use an array for the numbers, but I wanted to keep it simple, so you could see what is going on.

<%
set rs=server.createobject("ADODB.recordset")
rs.open "SELECT score from MyTable",conn

do while not rs.eof
tempscore=rs("score")

do while tempscore > 100
tempscore=tempscore - 100
response.write("<img src=""images/100.jpg>")
loop

do while tempscore > 50
tempscore=tempscore - 50
response.write("<img src=""images/50.jpg>")
loop

do while tempscore > 20
tempscore=tempscore - 20
response.write("<img src=""images/20.jpg>")
loop

do while tempscore > 10
tempscore=tempscore - 10
response.write("<img src=""images/10.jpg>")
loop

do while tempscore > 5
tempscore=tempscore 5
response.write("<img src=""images/5.jpg>")
loop

do while tempscore > 4
tempscore=tempscore - 4
response.write("<img src=""images/4.jpg>")
loop

do while tempscore > 3
tempscore=tempscore - 3
response.write("<img src=""images/3.jpg>")
loop

do while tempscore > 2
tempscore=tempscore - 2
response.write("<img src=""images/2.jpg>")
loop

do while tempscore > 1
tempscore=tempscore - 1
response.write("<img src=""images/1.jpg>")
loop

rs.movenext
loop

rs.close
set rs=nothing
%>

Hope this makes sense
__________________
Intelligence is not knowledge, but the way we use our knowledge.
Reply With Quote
  #3 (permalink)  
Old 09-18-06, 11:36 AM
rcpilotp51 rcpilotp51 is offline
New Member
 
Join Date: Jul 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks!

thanks GO4TF4CE

thats what i ended up figuring out...haha...thanks for the post!

Rcpilotp51
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump


All times are GMT -5. The time now is 03:49 PM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.