| This was a nice idea. I liked the approach. Essentially you call the "width"
numeral from the database. The trick is formatting the image src statement and also formatting the results so that they are easily readable. I created a 1 px X 1 px maroon colored .gif image named "bar.gif". I created a database called "test.mdb" and a table named "clients" with fields named "First_Name", "Last_Name" and "graphic_width". The graphic_width were just random numbers. Then I wanted to write out the results as Name, width as a numeral, and width as a bar graph. First, I called the data from the database with this sql string: strSQL = "SELECT First_Name,Last_Name,graphic_width FROM Clients ORDER BY First_Name" Then I used "Response.Write" to write information to the page that creates a table with as many rows as data entries and three columns (for the name, width as a numeral, and the bar graph). The code I used to make the "width" a part of the image src statement looked like this: ("<img src=""images/bar.gif"" width=""") & rs("graphic_width") & (""" height=""10"">") The statement is contained in parentheses; the first and last quote marks tell the browser to "write everything in between these quotes to the page"; if you look at the normal code for an image, you'll note that the src, the width and the height are all surrounded by quotes so we had to enclose the quotes in quotes to make sure they get written properly to the page; the & sign is a connector; the database call is the rs("graphic_width"). On the page, the code would look like this: <img src="images/bar.gif" width="25" height="10"> With the width number coming from the database. I used a little loop statement to show all of the results and then I added a bit of a header to clarify the entries. I used CSS to format the text. |
| Name | Width | Bar Graph | Angel Aamos | 95 | |
| Billy Bones | 75 | ||||
| Cryme Ariver | 15 | ||||
| Dewey Cheatham | 20 | ||||
| Dottie Ditz | 35 | ||||
| Geraldo Perez | 10 | ||||
| Jane Doe | 15 | ||||
| Jane Plain | 90 | ||||
| Joe Blow | 30 | ||||
| John Doe | 50 | ||||
| Jon Blade | 60 | ||||
| Kelly Kream | 5 | ||||
| Marky Mark | 35 | ||||
| Mary Smythe | 100 | ||||
| Michael Green | 20 | ||||
| Mike Mac | 10 | ||||
| Mike Amos | 85 | ||||
| Mollye May | 40 | ||||
| Muddy Waters | 25 | ||||
| Quincy Smith | 65 | ||||
| Salamander Snape | 70 | ||||
| Sally Amith | 45 | ||||
| sam Blue | 25 | ||||
| Sammy Spade | 55 | ||||
| Samuel Clemens | 40 | ||||
| Tim Tune | 80 | ||||
| Tool Time | 35 | ||||