三九宝宝网宝宝百科宝宝知识

高分急求用php写的购物车代码!!十万火急如果您提

02月17日 编辑 39baobao.com

[高分求用EXCEL制作一个排班表]纯粹按照你的图所示,就两个人的话,人多的话,VLOOKUP公式的区域需根据实际相应变更 C13公式: =today() C16公式: =DAY($C$13)+COLUMN()-4 公式向右拉到G16 B17公式: =VLOOKUP($A17,...+阅读

我也要弄一个这种购物车, 我去写个,贴出来,【嘿嘿,今天上午新写的】。 我懒得新建数据库,用的是我的数据库。 你按照我的改一下就能用了 本人水平有限,高手请指正。 你,大,爷的,虽然不咋地,保证能用 、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、、 经过调试, //$my->add_cart(45,3,"茶几系列");//新增购物 //$my->updata_cart(13,13,8); //更新购物 //$my->del_cart(12,5,'Guest'); //删除一种购物 //$my->empty_cart('Guest'); //清空购物车 $ok=$my->get_cart('Guest'); //返回购物车 这些都可用 ------------------------------------------------------------------- =1 and payment=0"; mysql_query($sql); } // 弹出提示 function alter($Str,$Url) { echo " alert('".$Str."');"; echo " "; } //增加购物;三个参数:pid:产品ID,ptl:产品数量,pcid:产品类别 //查询数据库,是否存在此人在本日内订过本产品 //如果订过,那么数量累加,否则插入一个数据库行 function add_cart($pid,$ptl=1,$pcid) { if($ptl>=100 || $ptlalter("最多买99件,最少1件","index.php"); die(); } if(!$_SESSION['usr']) { $usr='Guest';} else { $usr=$_SESSION['usr'];} $sql="select * from shopcart where and and"; $ex=mysql_query($sql); $ex1=mysql_fetch_array($ex); if(!$ex1) { $sql="select * from product where and class1='".$pcid."'"; $ok=mysql_query($sql); $rs=mysql_fetch_array($ok); if($rs) { $totalCost= $rs['Price'] * $ptl; $sql="insert into shopcart(usr,pid,pname,ptl,price,pcid,psum,payment) Values("; $sql.="'".$usr."',"; $sql.="'".$rs['ID']."',"; $sql.="'".$rs['Name']."',"; $sql.="'".$ptl."',"; $sql.="'".$rs['Price']."',"; $sql.="'".$rs['Class1']."',"; $sql.="'".$totalCost."',"; $sql.="'0')"; mysql_query($sql) or die(mysql_error()); if($ok) { $this->alter("购物成功","index.php"); } else { $this->alter("购物失败","index.php"); } } else { $this->alter("不存在的商品,或者参数错误","index.php"); die(); } } else { $sql="update shopcart set ptl= ptl+1,psum = psum+price whereID']."'"; mysql_query($sql); $this->alter("更新数量成功","index.php"); } } //更新购物车的单个产品的数量; function updata_cart($cid,$ptl,$pid) { if($ptl>=100||$ptlalter('产品数量不对!','index.php'); die(); } $sql="select * from shopcart where and"; $ok=mysql_query($sql); if(!ok) { alter("参数发生错误","index.php");} else { $sql="update shopcart set,psum=price * '".$ptl."' where and"; $ok=mysql_query($sql); if(!ok) { $this->alter("更新失败","index.php");} else { $this->alter("更新成功","index.php");} } } function del_cart($cid,$pid,$usr) { $sql="delete from shopcart where and and"; $ok=mysql_query($sql); if(!$ok) {$this->alter("删除失败","index.php");} else {$this->alter("删除成功","index.php");} } function empty_cart($usr) { $sql="delete from shopcart where"; mysql_query($sql) or die(mysql_error); } function get_cart($usr) { $sql="select * from shopcart where"; $ok=mysql_query($sql); return $ok; } } $my = new Cart("localhost","root","root","mybbs"); //$my->add_cart(45,3,"茶几系列"); //$my->updata_cart(13,13,8); //$my->del_cart(12,5,'Guest'); //$my->empty_cart('Guest'); $ok=$my->get_cart('Admin'); echo "usr pid pname ptl price pcid psum payment ptime "; while($rs=mysql_fetch_array($ok)) { echo $rs[1]."->".$rs[2]."->".$rs[3]."->".$rs[4]."->".$rs[5]."->".$rs[6]."->".$rs[7]."->".$rs[8]."->".$rs[9]." "; } ?>、、、、、、、、、、、、、、、、、SQL、、、、、、、、、、、、、、 CREATE TABLE IF NOT EXISTS `shopcart` ( `ID` int

(10) NOT NULL auto_increment, `usr` varchar(50) NOT NULL, `pid` int

(5) NOT NULL, `pname` varchar(100) NOT NULL, `ptl` int

(3) NOT NULL, `price` decimal(50,2) NOT NULL default '0.00', `pcid` varchar(100) NOT NULL, `psum` decimal(50,2) NOT NULL default '0.00', `payment` tinyint

(1) NOT NULL, `ptime` timestamp NOT NULL default CURRENT_TIMESTAMP, PRIMARY KEY (`ID`) ) product 里面用的ID CLASS1是 `ID` int

(6) NOT NULL auto_increment, `Class1` varchar(20) NOT NULL, `Price` int

(6) NOT NULL,

以下为关联文档:

php如何生成HTML页面要详细的生成过程代码很简单,用ob_start压制,然后保存到一个html页面就可以了,写了个小演示 访问时在后面加参数 ?id=xxx xxx为任意数字,你把里面的输出换成你的动态页面就可以了,代码里有解释 ob_star...

求用英语购物情景对话店员:what can i do for you? 顾客:I'd like to buy a piece of shirts 店员:this way please,what color would you like? 顾客:red or blue。 店员:what size do you want? 客...

求用英文写的关于读书的名言名句英文写的关于读书的名言名句:Early to bed and early to rise , makes a man healthy , wealthy and wise .(Benjamin Franklin , American president ) 早睡早起会使人健康...

急求美国本土和夏威夷旅游购物指南!1. 夏威夷的话,虽然免税,但是去过的人都感觉东西实在是太少,因为买的人太多了,很多东西都缺货,并不比美国大陆的东西好,而且打折力度也不如本土普通的outlets。 化妆品由于专卖店...

求一份jsp mysql的代码网上购物系统的最好带上数据库一起展开全部 一、eclispse是写开发代码的软件,最简单的理解方法就是,你用记事本写文字,文字等于编程语言的代码,记事本就等于eclipse。明白? 二、tomcat是你这个系统运行所需要的服...

求JSP购物服饰系统的源代码<script type="text/javascript"> function jisuan() { var text1=document.getElementById('text1').value; var text2=document.getElementById('text2').value; var text3=...

php生成excel完整实例代码下载phpexcel类库 代码如下: <?php require_once('PHPExcel.php'); require_once('PHPExcel/IOFactory.php'); $objPHPExcel=new PHPExcel(); $iofactory=new IOFactory(); /...

急求php导出生成excel的代码$id=$_REQUEST['id']; $savedate = date("YmjHis"); $savename = "$savedate"; mysql_query("Set Names 'gbk'"); $file_type = "vnd.ms-excel"; $file_ending = "xls"; header("Conten...

求助php代码简单修改跪求大侠相助!谢谢if ($_POST['nextstep'] == 1) { $c_params = array ( 'username' => $_POST['username'], 'password' => $_POST['password'], 'domain' => $_SERVER['HTTP_HOST'] ); 去掉...

推荐阅读
图文推荐