...

View Full Version : question about Sql / Asp and some pictures :-)



retrotoys.nl
08-12-2005, 07:32 PM
Hi,

Thanks for reading this post, hope you can help me!! :thumbsup:

I'm trying to biuld a website + shop with aspapp.com
The store shows the actual stock position. This number (asp code) is called <% =AvailQty %>. The stock position knows only 10 positions
so the stock is always

1;2;3;4;5;6;7;8;9;10

I want in stead of showing a number that the page shows a picture.
so if the stock is 2 it must show picture 2.jpg
if somebody buys 1 product the new stock will be one, this happens of course automaticly after a sales. the new picture that must shows at the stock must be 1.jpg.

Can osmebody please tell me how I can make somthing like this??

Thanks Sander

retrotoys.nl
08-12-2005, 08:24 PM
found it:

<%if (availQty)=0 then%>
<img src="status0.gif" width="100" height="19"><% end if %>
<%if (availQty)=1 then%>
<img src="status1.gif" width="100" height="19"><% end if %>
<%if (availQty)=2 then%>
<img src="status2.gif" width="100" height="19"><% end if %>
<%if (availQty)=3 then%>
<img src="status3.gif" width="100" height="19"><% end if %>
<%if (availQty)=4 then%>
<img src="status4.gif" width="100" height="19"><% end if %>
<%if (availQty)=5 then%>
<img src="status5.gif" width="100" height="19"><% end if %>
<%if (availQty)=6 then%>
<img src="status6.gif" width="100" height="19"><% end if %>
<%if (availQty)=7 then%>
<img src="status7.gif" width="100" height="19"><% end if %>
<%if (availQty)=8 then%>
<img src="status8.gif" width="100" height="19"><% end if %>
<%if (availQty)=9 then%>
<img src="status9.gif" width="100" height="19"><% end if %>
<%if (availQty)>10 then%>
<img src="status10.gif" width="100" height="19"><% end if %>

Bullschmidt
08-13-2005, 01:08 AM
Thanks for posting what worked.

And another similar code structure is:

If blah1 Then
...
Elseif blah2 Then
...
Elseif blah3 Then
...
Else
...
End If

SpirtOfGrandeur
08-13-2005, 08:24 PM
Look up Select Case Else... Itll do what you need...

BaldEagle
08-14-2005, 04:30 AM
<img src="status<%=availQty%>.gif" width="100" height="19">

This should eliminate all the code.

BaldEagle

[edit]
Actually I didn't read closely enough: You'll have to have one check for availQty > 10, then all others use the above format.

Also there is nothing to cover availQty = 10.

Based on you original post it should be availQty > 9.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum