 |
|
|
 |
 |
|
<%@ codepage="874" %>
<% Option Explicit %>
<!--#include file="include/dbconnect.asp" -->
<html>
<head><title>ค้นหาสินค้า</title></head>
<body>
<!--#include file="include/header.htm" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="24%" valign="top">
<!--#include file="include/menu.asp" --> </td>
<td width="76%" valign="top"><hr>
<form action="sscart.asp" method="post">
<%
dim pname,rs,sql
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
rs.absolutepage = cint(page)
rowcount=0
do while not rs.eof and rowcount<2
%>
<table width="90%" border="0" cellspacing="10" cellpadding="10" align="center">
<tr>
<td width="20%">
<a href="detail.asp?pid=<%=rs("pid")%>">
<img src="pimages/<%=rs("pimages")%>" border="0" width="200"></a> </td>
<td width="80%" valign="top">
<b>ชื่อสินค้า :</b>
<a href="detail.asp?pid=<%=rs("pid")%>">
<%=rs("pname")%></a><br>
<b>หมวดหมู่สินค้า :</b> <%=rs("catname")%><br>
<strong>จำนวนสินค้าที่มีอย</strong>ู่ : (<%=rs("total")%>) กล่อง<br>
<b>รายละเอียด :</b> <%=replace(rs("pdescriptions"),vbcrlf,"<br>")%><br>
<b>ราคา :</b> <i><font size="-1" color="#CCCCCC"><%=formatnumber(rs("pprice"),2)%> บาท</font></i><br>
<b>ราคาพิเศษ :</b> <b><font size="+1" color="#FF6600"><%=formatnumber(rs("pdiscount"),2)%> บาท</font></b><br><br>
<input name="" type="image" src="images/add2cart.gif"> </td>
</tr>
</table>
</p>
<hr>
<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>
|
 |
 |
 |
 |
Date :
1 เม.ย. 2551 18:00:01 |
By :
terayut |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
<%@ codepage="874" %>
<% Option Explicit %>
<!--#include file="include/dbconnect.asp" -->
<html>
<head><title></title></head>
<body>
<!--#include file="include/header.htm" -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="24%" valign="top">
<!--#include file="include/menu.asp" --> </td>
<td width="76%" valign="top"><hr>
<form action="sscart.asp" method="post">
<%
dim price1,price2,rs,sql
price1 = request("price1")
price2 = request("price2")
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
rs.absolutepage = cint(page)
rowcount=0
do while not rs.eof and rowcount<2
%>
<table width="90%" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td width="20%">
<a href="detail.asp?pid=<%=rs("pid")%>">
<img src="pimages/<%=rs("pimages")%>" border="0" width="200"></a> </td>
<td width="80%" valign="top">
<b>ชื่อสินค้า :</b>
<a href="detail.asp?pid=<%=rs("pid")%>">
<%=rs("pname")%></a><br>
<b>หมวดหมู่สินค้า :</b> <%=rs("catname")%><br>
<b>รายละเอียด :</b> <%=replace(rs("pdescriptions"),vbcrlf,"<br>")%><br>
<b>ราคา :</b> <i><font size="-1" color="#CCCCCC"><%=formatnumber(rs("pprice"),2)%> บาท</font></i><br>
<b>ราคาพิเศษ :</b> <b><font size="+1" color="#FF6600"><%=formatnumber(rs("pdiscount"),2)%> บาท</font></b><br><br>
<input name="" type="image" src="images/add2cart.gif"> </td>
</tr>
</table>
</p>
<hr>
<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 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันที่1 เป็นการค้นหาตัวหนังสือ
อันที่ 2 เป็นการค้นหาราคาครับ
ภาษา asp for e-comerces อ่ะครับ ไม่รู้ถูกใจป่าว
|
 |
 |
 |
 |
Date :
1 เม.ย. 2551 18:03:43 |
By :
terayut |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เท่ห์จัง
|
 |
 |
 |
 |
Date :
1 เม.ย. 2551 19:17:17 |
By :
:) |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อยากได้ php อ่ะคัรบ แต่ก็ขอบคุนมากนะครับ
|
 |
 |
 |
 |
Date :
2 เม.ย. 2551 09:06:14 |
By :
srenon |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|