Looping records

Discussion in 'C#' started by Env, Jul 21, 2009.

  1. #1
    Hello

    I have tried and tested this, but no luck. Everytime I want to include this promo box, it keeps display

    1 record
    break
    promo box
    2 record
    break promo box




    DATA 1 | DATA 2 | DATA 3 | DATA 4 |

    | PROMOTION BOX 1 |

    DATA 5 | DATA 5 | DATA 7 | DATA 8 |

    | PROMOTION BOX 2 |

    DATA 9 | DATA 10 | DATA 11 | DATA 12 |

    | PROMOTION BOX 3 |




    To give a better idea, http://tinyurl.com/nfq74e , look in the right bar and notice all records are being display in 4 rows then a break. I am trying to add this promo box which all three can see at the end of the page.. (I am one, I am three etc)


    This is the code I am using (note promo boxes are not part of loop now)


    		<%
    				dim shortdesc
    				dim magicURL
    				sql = "SELECT * FROM tblProducts JOIN tblCategories ON tblProducts.BoxCategory = tblCategories.CategoryID WHERE tblProducts.OnOffer =1 AND Availbox =1 ORDER BY FeaturedPos" 
    				set rs = CreateObject("ADODB.Recordset") 
    				rs.open sql, conn.c
    				if rs.fields("BoxCategory") <> rs.fields("BoxCategory2") then
    						catestr = getUrlForCategory(rs.fields("BoxCategory2"))
    					else
    						catestr = getUrlForCategory(rs.fields("BoxCategory"))
    					end if
    						prostr = catestr & replaceUrl(rs.fields("ProductName")) & ".html"				
    					if not rs.EOF then
    						count = 1
    					while rs.EOF = false
    					if count <=4 then
    					'if count >=4 then
    									ID=rs("ProductID")
    									response.Write("<div class='single-product'>"&id&"</div>")
    									'response.write("")
    									count=0
    									
    									
    					'else
    					'				ID=rs("ProductID")
    					'				response.Write(id)
    									
    					end if
    					'if count >4 then
    									'response.Write("Hello greater than 4 do something now")		
    					'end if			
    									
    									count = count +1
    									rs.movenext
    									'
    					wend
    				end if 
    		%>
    		<br />
    		<div class="promo-box"><!--#include virtual='/promo/boxingpromo1.txt'--></div>
    		<div class="promo-box"><!--#include virtual='/promo/boxingpromo2.txt'--></div>
    		<div class="promo-box"><!--#include virtual='/promo/boxingpromo3.txt'--></div>
    Code (markup):
    I am willing to sort someone out via paypal for this fix
     
    Env, Jul 21, 2009 IP