Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

comma in mysql database...retrieving sizes....

Status
Not open for further replies.

cloudseven

Programmer
Mar 16, 2003
18
0
0
CA
hi there, I am working on an e-commerce site and I have different sizes for a line of clothing. Instead of adding different fields for S,M,L. I would like to just add one field that contains all the sizes separated by commas. I don't know how to retrieve it from the database into a selectbox when there are commas in that field. What function do I use to look for the comma? Thanks in advance!
 
Personally I would stick to the fields but anyway...

Grab the recordset from the DB then use

Sizes=Split(RS("sizesfieldname"),",")
' this splits the field into an array called sizes

<select name=&quot;&quot;>
<%
for i = 0 to ubound(sizes)
response.write&quot;<option>&quot; & sizes(i) & &quot;</option>
next
%>
</select>



 
hey gary, yeh usually I use separate fields but I wanted to try another way...thanks a bunch!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top