熟女人妻少妇精品视频,污污的网站,无码熟熟妇丰满人妻啪啪,中文人妻AV久久人妻水

專(zhuān)業(yè)的廣州網(wǎng)站建設公司、廣州網(wǎng)站設計制作公司為您服務(wù),電話(huà):020-85548809,29883069
新聞中心
專(zhuān)業(yè)專(zhuān)注專(zhuān)心,行業(yè)行情行規
分享交流,永無(wú)止境,我們愿與您共同進(jìn)步

ASP購物車(chē)代碼超級簡(jiǎn)單

發(fā)布日期:[2010/10/28]   編輯:奇億廣州網(wǎng)站建設

將以下ASP購物車(chē)代碼都保存為一個(gè)文件,如cart.asp,調用時(shí)比如加入購物車(chē)直接使用鏈接cart.asp?id=商品ID即可。本例中商品數據庫表為product,使用到商品ID,商品名稱(chēng)product_name等,在實(shí)際使用ASP購物車(chē)代碼時(shí)將相關(guān)參數替換下。
<%'簡(jiǎn)單ASP購物車(chē)代碼原理
action=request.QueryString("action")
if request.QueryString("id")="" then
bookid=session("productlist")'//////////////////////////////////調入查詢(xún)物品的id
else
  if session("productlist")="" then
session("productlist")=request.QueryString("id")
bookid=request.QueryString("id")
  else
    if instr(request.querystring("id"),session("productlist"))<1 then
bookid=session("productlist")+","+request.QueryString("id")'//////////////把id全部存儲到bookid中類(lèi)似與數組
session("productlist")=bookid
    else
bookid=session("productlist")
    end if
  end if
end if

if session("productlist")="" then'////////////////////////若id為空,則說(shuō)明用戶(hù)沒(méi)有購物
bookid=0
end if

if action="del" then '刪除購物車(chē)中的某一件商品
aProducts=split(Session("ProductList"),",")
delid=cstr(trim(Request.QueryString("id")))
For i=0 To UBound(aProducts)    '循環(huán)所有商品ID
    If trim(aProducts(i))<>delid then
        '不等于被刪除的ID時(shí)則保存進(jìn)新的列表中
        sNewProducts = sNewProducts & "," & aProducts(i)
    end if
Next
Session("ProductList") = mid(sNewProducts,2)
  if session("ProductList")="" then
bookid=0
  else
bookid=Session("ProductList")
  end if
end if
%>

以下是ASP購物車(chē)里的所有商品:<br><br>
<%'根據臨時(shí)存儲到SESSION里的商品ID分別從商品數據庫循環(huán)調出商品顯示到購物車(chē)頁(yè)面,遇到重復ID不顯示
if bookid<>0 and bookid<>"" then
set rs=server.CreateObject("adodb.recordset")
dim sql
sql="select id,product_name from product where id in ("&bookid&") order by id" '這里替換成實(shí)際的商品數據庫及字段
rs.open sql,conn,1,1
   dim bookscount,books '定義判斷有幾個(gè)bookid
   bookscount=request.QueryString("id").count
   aa=1
   do while not rs.eof
   dim quatity '判斷input 名
Quatity = CInt( Request( "ckxp"&rs("id")) )
If Quatity <=0 Then Quatity = 1
'以下為購物車(chē)每一件商品內容,包含ID、名稱(chēng)、數量及取消
%>

商品ID:<%=rs("id")%>
商品名稱(chēng):<a href="showproduct.asp?id=<%=rs("id")%>" title="<%=rs("info")%>" target="_blank"><%=rs("product_name")%></a>
訂購數量:<input name="sl<%=aa%>" type="text" Value="1" size="3">
取消商品:<a href="?nav=m&id=<%=rs("id")%>&action=del"><font color="#FF0000" size="4" style="font-weight:bold">×</font></a>
<br>

<%'循環(huán)讀取ASP購物車(chē)內的商品
rs.movenext
aa=aa+1
loop
rs.close
set rs=nothing
%>
<%if bookid=0 or bookid="" then%>ASP購物車(chē)內沒(méi)有商品,請選擇需訂購的商品。<%end if%>

廣州建網(wǎng)站、廣州做網(wǎng)站
或者將本文《ASP購物車(chē)代碼超級簡(jiǎn)單》收藏和分享到:
復制本文《ASP購物車(chē)代碼超級簡(jiǎn)單》地址給好友:
泸溪县| 湘乡市| 呼和浩特市| 梨树县| 南投县| 确山县| 山阳县| 汉阴县| 太康县| 台湾省| 临沧市| 垣曲县| 丹巴县| 藁城市| 分宜县| 称多县| 宿松县| 邻水| 玉溪市| 阜新市| 延庆县| 阿克苏市| 盘山县| 辽阳县| 左权县| 依兰县| 睢宁县| 唐海县| 凌云县| 扬中市| 伊通| 疏勒县| 德保县| 佛坪县| 荣成市| 景谷| 宿松县| 洪湖市| 浏阳市| 桑植县| 双峰县|