1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Expected End of Statement.....

Discussion in 'C#' started by johnyfav, Oct 19, 2005.

  1. #1
    I have been looking at this code for the last 45 mins and I really can't see what I have done wrong. Can someone please put me out of my misery?
    SEMrush
    
    <%
    Dim johnsectstuff
    Dim thePrioductURL
    Set liveProducts = Server.CreateObject("ADODB.Recordset")
    liveProducts.ActiveConnection = MM_TBW2003_STRING
    liveProducts.Source = "SELECT dbo.productsInSubSections.subSectionID AS subsectionid, dbo.products.id AS productid, dbo.products.introText AS introtext, dbo.products.productName AS productname, dbo.products.manufacturer AS manufacturerid, dbo.manufacturer.manufacturerName AS manufacturername, dbo.productOptions.productOptionName AS productoptionname, dbo.productOptions.productOptionDescription AS productdescription, dbo.productOptions.productCode AS productcode, dbo.productOptions.shopRRP, dbo.productOptions.shopPromotionalPrice, dbo.productOptions.shopOfferPrice, dbo.productOptions.includeInShop, dbo.productOptions.type, dbo.productOptions.id AS prodoptionid, dbo.subSections.subSectionName AS subsectionname, dbo.sections.id AS sectionid, dbo.sections.sectionName AS sectionname, dbo.productOptions.stockStatus FROM dbo.products INNER JOIN dbo.productOptions ON dbo.products.id = dbo.productOptions.productID INNER JOIN dbo.manufacturer ON dbo.products.manufacturer = dbo.manufacturer.id INNER JOIN dbo.productsInSubSections ON dbo.products.id = dbo.productsInSubSections.productID INNER JOIN dbo.subSections ON dbo.productsInSubSections.subSectionID = dbo.subSections.id INNER JOIN dbo.sections ON dbo.subSections.relatedSection = dbo.sections.id WHERE (dbo.products.active = 1) AND (dbo.productOptions.type = 1) AND (dbo.productOptions.includeInShop = 1)"
    liveProducts.CursorType = 0
    liveProducts.CursorLocation = 2
    liveProducts.LockType = 1
    liveProducts.Open()
    
    theURLSectionName = replace(liveProducts("sectionname"), "/ ", "")
    %>
    <%
    while not liveProducts.eof
    
    johnsectstuff = liveProducts("sectionid") 
    if johnsectstuff = 1 or 12 then
    response.write "Computer Accessories | Scanner" 
    else if johnsectstuff = 4 or 13 then
    response.write "Printers | Label" 
    else if johnsectstuff = 3 then
    response.write "PDA | Product" 
    else if johnsectstuff = 7 then
    response.write "Software | Windows Software" 
    else if johnsectstuff = 11 then
    response.write "Computer Accessories | Printer Accessory" 
    else 
    response.write "Missing"
    end if 'johnsectstuff
    %>
     | 
    <% 'Manufacturer Name %>
    <% response.write liveProducts("manufacturername") %>
     | 
    <% 'Product Name %>
    <% response.write liveProducts("productname") %> - <% response.write liveProducts("productoptionname") %>
     | | | | | | |
    <% ' MPN %>
    <% response.write liveProducts("productcode") %>
     | 
    <% response.write liveProducts("prodoptionid") %>
     | 
    <% response.Write liveProducts("introText") %>
     | |
    http://www.thebarcodewarehouse.co.uk/images/products/<% response.write liveProducts("productid") %>.jpg | 
    http://www.thebarcodewarehouse.co.uk/<%= server.URLEncode(lcase(theURLsectionName)) %>/<%= server.URLEncode(lcase(liveProducts("manufacturername"))) %>/<%= server.URLEncode(lcase(liveProducts("productname"))) %>/<%= liveProducts("productid") %>/<%= liveProducts("subSectionid") %>/0 | 
    <%
    Dim froogleprice
    
    if liveProducts("shopOfferPrice") > 0 then
    	froogleprice=liveProducts("shopOfferPrice")
    else
    	if liveProducts("shopPromotionalPrice") > 0 then
    		froogleprice=liveProducts("shopPromotionalPrice")
    	else
    		froogleprice=liveProducts("shopRRP")
    	end if
    end if
    froogleprice=formatNumber((froogleprice * 1.175), 2)
    response.write froogleprice
    %>
     | 
    <% if froogleprice > 100 then %>
    0 |
    <% else %>
    10 |
    <% end if %>
    <% if liveProducts("stockStatus") = 1 then %>
    Next Day | In Stock |
    <% else if liveProducts("stockStatus") = 12 then %>
    Usually 2-3 days | Available on Order | 
    <% else if liveProducts("stockStatus") = 13 then %>
    Usually 3-5 days | Available on Order | 
    <% else if liveProducts("stockStatus") = 14 then %>
    Usually 5-7 days |Available on Order | 
    <% else if liveProducts("stockStatus") = 15 then %>
    Usually 7-10 days | Available on Order | 
    <% else if liveProducts("stockStatus") = 16 then %>
    Usually 10-14 days | Available on Order | 
    <% else if liveProducts("stockStatus") = 17 then %>
    Usually 2-3 weeks | Available on Order | 
    <% else if liveProducts("stockStatus") = 18 then %>
    Usually 3-4 weeks | Available on Order | 
    <% else if liveProducts("stockStatus") = 19 then %>
     | Pre-Order |
    <% else if liveProducts("stockStatus") = 20 then %>
     | Check Site |
    <% End if %>
    <% response.write " New | <br> " %>
    
    
    <%
    liveProducts.movenext
    
    Wend
    
    liveProducts.Close()
    set liveProducts = nothing
    %>
    
    
    
    Code (markup):
    Many many thanks in advance.
     
    johnyfav, Oct 19, 2005 IP
    SEMrush
  2. johnyfav

    johnyfav Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    my bad.

    It was the else if's having a gap in between.....
     
    johnyfav, Oct 19, 2005 IP
  3. vectorgraphx

    vectorgraphx Guest

    Messages:
    545
    Likes Received:
    16
    Best Answers:
    0
    Trophy Points:
    0
    #3
    that'll get ya... gets me every now and then. glad you spotted it. elseif vs. else if are easy mistakes to make.

    Welcome to DP, by the way :)
     
    vectorgraphx, Oct 19, 2005 IP
  4. stueym

    stueym Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    I always have problems with remembering them. I programmed a lot of Java and sometimes completely forget the 'then' s if I get carried away!
     
    stueym, Oct 21, 2005 IP