现在有两个表:class1(sortid,sort),gsm(sortid,model,price),第一个表为手机分类,如:1-诺基亚,2-摩托罗拉,3-西门子…………,第二个表为每个型号手机价格表:如1-3100-700(表诺基亚3100的价格为700),1-7180-1200(表诺基亚7180的价格为1200),3-2900-1700(表西门子2900的价格为1700)…………
然后做成这样的:
我像这样写,但是有错,偶也知道,就是不会改,大家帮帮忙!
记录:
<%
set rs=server.createobject("adodb.recordset")
sql="select * from class_4"
rs.open sql,conn,1,1
count=rs.recordcount
sortid=rs("sortid")
set rs1=server.createobject("adodb.recordset")
sql1="select * from gsm where sortid="&sortid
rs1.open sql1,conn,1,1
count1=rs1.recordcount
%>
以下是显示部分(有错):
<%for i=1 to count %>
<tr>
<td width="9%" bgcolor="#FFD8B0"><div align="center"><%=rs("sort")%></div></td>
<td width="91%"><table width="100%" border="1" cellpadding="1" cellspacing="0" bordercolor="#ffffff">
<tr bgcolor="#ADECFC">
<td width="28%" height="31"><div align="center">型号</div></td>
<td width="32%"><div align="center">价格</div></td>
<td width="40%"><div align="center">备注</div></td>
</tr>
<% do while not rs1.eof %>
<tr bgcolor="#E1F7FD">
<td><div align="center"><%=rs1("model")%></div></td>
<td><div align="center"><%=rs1("price")%></div></td>
<td><div align="center"><%=rs1("content")%></div></td>
</tr>
<% rs1.movenext
loop
rs1.close
set rs1=nothing
%>
</table></td>
</tr>
<%rs.movenext
next
rs.close
set rs=nothing
%>