basket.php
来自「这个版本只是修正了一些BUG」· PHP 代码 · 共 61 行
PHP
61 行
<?php
/***********************************************
basket.php
Version : 1.2
Author : Tracemouse (tracemouse@msn.com)
Copyright: www.vitci.com
Writed : 2003/08/08
Modified : 2003/04/14
***********************************************/
require "./include/base.php";
$nav .= SEPARATER."<a href='myshop.php'>".$language['myshop']."</a>".SEPARATER.$language['myshop_basket'];
if (!$islogin)
{
include template('login');
exit;
}
if($changenumber)
{
if(is_array($amount))
{
foreach($amount as $key => $value)
{
$query=$db->query("UPDATE $table_basket SET amount=$value
WHERE username='$_login_user' and productid=$key and oid='picking'");
}
}
if(is_array($delete))
{
$ids = $comma = "";
foreach($delete as $id)
{
$ids .= "$comma'$id'";
$comma = ", ";
}
$db->query("DELETE FROM $table_basket WHERE username='$_login_user' and productid IN ($ids) and oid='picking'");
}
showmessage('update suc','basket.php');
}
$basketlist = array();
$query = $db->query("select count(*) from $table_basket where username='$_login_user' and oid='picking'");
$basketnum=$db->result($query,0);
$sqlstr="select a.productid,b.productname,b.unit,a.price,a.amount
from $table_basket a,$table_products b where a.productid=b.productid and a.username='$_login_user' and a.oid='picking'";
$query = $db->query($sqlstr);
$totalprice=0;
$totalnum=0;
while($dbq_rec = $db->fetch_array($query))
{
$totalprice+=$dbq_rec['price']*$dbq_rec['amount'];
$totalnum+=$dbq_rec['amount'];
$dbq_rec['price']=number_format($dbq_rec['price'],2,".",",");
$basketlist[] = $dbq_rec;
}
$totalprice=number_format($totalprice, 2, ".", ",");
include template('basket');
?>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?