NuGG 15 Junior Poster

Hi there, I am trying to combline results form a query into one variable/string without drastically changing the sites current code.

Bacically I have been trying to add rs2("name") for each record into one string. For example, say the customer has "item1", "item2", and "item3" in their basket, well I want to combine each of these together into one single variable called "stuffall." (like "item1 item2 item3") The code I am using can be found below, and I have highlighted the problem areas using <<<>>>.

I assumed, as in php, this would be possible by adding rs2("name") into a var "stuff" and then when it moves to the next record it will add "stuff" to "stuffall" plus the next rs2("name"), this however doesnt seem to work and just returns error 500.

            <%
            sql = "SELECT * FROM basket_products WHERE basket_id="&rs("basket_id")
            set rs2 = objconn.execute(sql)
            while not rs2.eof
            linetotal=formatnumber(formatnumber(rs2("priceperunit"),2)*rs2("qty"),2)

<<<>>>      stuff=rs2("name")      <<<>>>

            %>
              <tr class="baskettable">
                <td><%=rs2("product_id")%></td>
                <td><%=rs2("qty")%></td>
                <td><%=rs2("name")%></td>
                <td><div align="right">&pound;<%=formatnumber(rs2("priceperunit"),2)%></div></td>
                <td><div align="right">&pound;<%=linetotal%></div></td>

              </tr>
              <% 
             rs2.movenext

 <<<>>>      stuffall=stuff+rs2("name")      <<<>>>

            wend
            %>

If anyone can help in anyway, id appricate it, its been bugging me for days now!

Cheers.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.