pname = request("pname")
if connectdb() = true then
sql = "select * from categories as c inner join products as p on c.catid=p.catid where p.pname like '%"& pname &"%' and c.catactive=true and p.pactive=true"
dim varname,varvalue
Sub checknull(varname,varvalue)
if (varname="") then
response.Write("<script>"& _
"alert('กรุณากรอก"& varvalue &"ด้วยครับ');"& _
"history.back();"& _
"</script>")
response.End()
end if
end Sub
call checknull(pname,"สิ่งที่ต้องการค้นหา")
' set rs = conn.execute(sql)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.cursorType = 3 'ชนิดของ Cursor สามารถถอยหลังได้
rs.PageSize = 2 ' กำหนดจำนวนเรคคอร์ดต่อหน้า
rs.open sql, Conn
if rs.eof then
response.Write("<script>"& _
"alert('ไม่พบรายการสินค้าที่ต้องการ กรุณาค้นหารายการสินค้าใหม่อีกครั้งครับ');"& _
"history.back();"& _
"</script>")
response.End()
end if
dim page , rowcount
page = request.QueryString("page")
if page = "" or page="0" then page=1
<input name="pid" type="hidden" value="<%=rs("pid")%>">
<input name="pname" type="hidden" value="<%=rs("pname")%>">
<input name="pdiscount" type="hidden" value="<%=rs("pdiscount")%>">
</form>
<%
rowcount=rowcount+1
rs.movenext
loop
end if
%> หน้า
<%
dim i
for i=1 to rs.pagecount
if cint(page)= i then
response.Write(i &" ")
else
%>
<a href="search.asp?pname=<%=pname%>&page=<%=i%>"><%=i%></a>
<%
end if
next
%>
<br>
<b> รายการสินค้าทั้งหมด <%=rs.recordcount%> รายการ</b></td></tr>
<tr>
<td> </td>
<td>
</td>
</tr>
</table>
<!--#include file="include/footer.htm" -->
</body>
</html>
if (price1="" or price2="") then
response.Write("<script>"& _
"alert('กรุณากรอกราคาที่ต้องการค้นหาให้ครบด้วยครับ');"& _
"history.back();"& _
"</script>")
response.End()
end if
if connectdb() = true then
sql = "select * from categories as c inner join products as p on c.catid=p.catid where p.pdiscount between "& price1 &" and "& price2 &" and c.catactive=true and p.pactive=true order by p.pdiscount"
' set rs = conn.execute(sql)
Set rs = Server.CreateObject("ADODB.Recordset")
rs.cursorType = 3 'ชนิดของ Cursor สามารถถอยหลังได้
rs.PageSize = 2 ' กำหนดจำนวนเรคคอร์ดต่อหน้า
rs.open sql, Conn
if rs.eof then
response.Write("<script>"& _
"alert('ไม่พบรายการสินค้าที่ต้องการ กรุณาค้นหารายการสินค้าใหม่อีกครั้งครับ');"& _
"history.back();"& _
"</script>")
response.End()
end if
dim page , rowcount
page = request.QueryString("page")
if page = "" or page="0" then page=1
<input name="pid" type="hidden" value="<%=rs("pid")%>">
<input name="pname" type="hidden" value="<%=rs("pname")%>">
<input name="pdiscount" type="hidden" value="<%=rs("pdiscount")%>">
</form>
<%
rowcount=rowcount+1
rs.movenext
loop
end if
%> หน้า
<%
dim i
for i=1 to rs.pagecount
if cint(page)= i then
response.Write(i &" ")
else
%>
<a href="searchprice.asp?price1=<%=price1%>&price2=<%=price2%>&page=<%=i%>"><%=i%></a>
<%
end if
next
%>
<br>
<b> รายการสินค้าทั้งหมด <%=rs.recordcount%> รายการ</b></td></tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<!--#include file="include/footer.htm" -->
</body>
</html>
Date :
1 เม.ย. 2551 18:01:05
By :
terayut
No. 3
Guest
อันที่1 เป็นการค้นหาตัวหนังสือ
อันที่ 2 เป็นการค้นหาราคาครับ
ภาษา asp for e-comerces อ่ะครับ ไม่รู้ถูกใจป่าว