Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Converting a database number to an image

Status
Not open for further replies.

Craigieboy

Programmer
May 25, 2001
71
GB
Hi all...

I have a SQL database with a column named 'number_of_wins'. In this column are numbers - zero to whatever.

In an ASP page I am displaying several columns in a table and instead of displaying my number of wins column as purely a number I would like to display it as an image, for example a small blue block - 3 blue blocks if the value is 3 in the database, etc. if you know what I mean.

Is there a way of carrying out this conversion depending on the number value in the database?

I look forward to any pointers.

With thanks in advance,
Craig
 
yes as follows

**************************************

'connect to your database
'run your query here
'[for arguments sake we will say that the number you pull
'from the database has been given the variable "number"
'firstly make sure that your pics are labeled with a number
'and then .jpg, ie 1.jpg 2.jpg etc]

<%
Dim image
image = number & &quot;.jpg&quot;
%>

'now all you need to do is call the image tag to place the
'pic on the page

<img src=&quot;<% =image %>&quot; >

hope that helps
 
Excellent, thanks krappleby025!

So easy - I really should have worked that one out for myself!

With it being Friday my mind is more on the pub tonight and that taste of crisp cold beer :-9 than on the job in hand.

Many thanks,
Craig
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top