Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy question about Sql / Asp and some pictures :-)

    Hi,

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

    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

  • #2
    New to the CF scene
    Join Date
    Aug 2005
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Lightbulb

    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 %>

  • #3
    Regular Coder
    Join Date
    Aug 2002
    Location
    USA
    Posts
    478
    Thanks
    0
    Thanked 2 Times in 2 Posts
    Thanks for posting what worked.

    And another similar code structure is:

    If blah1 Then
    ...
    Elseif blah2 Then
    ...
    Elseif blah3 Then
    ...
    Else
    ...
    End If
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  • #4
    Regular Coder
    Join Date
    May 2005
    Location
    Michigan, USA
    Posts
    566
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Look up Select Case Else... Itll do what you need...
    Note: I do not test code. I just write it off the top of my head. There might be bugs in it! But if any thing I gave you the overall theory of what you need to accomplish. Also there are plenty of other ways to accomplish this same thing. I just gave one example of it. Other ways might be faster and more efficient.

  • #5
    Regular Coder
    Join Date
    Apr 2005
    Location
    Lisbon, CT
    Posts
    339
    Thanks
    0
    Thanked 0 Times in 0 Posts
    <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.
    Last edited by BaldEagle; 08-20-2005 at 05:14 PM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •