to:qlingying(susu)
是的 就是你说的那个程序 怎么了?好象搞的你很NB 有本事自己写一个啊 就知道抄袭别人的 你不配做程序员!听到你说这样的话就知道你是个没前途人.
另外 我在select.php 中忘了写一行 现在补充在这 是在select.php的最后
header("location:list.php");
是的 就是你说的那个程序 怎么了?好象搞的你很NB 有本事自己写一个啊 就知道抄袭别人的 你不配做程序员!听到你说这样的话就知道你是个没前途人.
另外 我在select.php 中忘了写一行 现在补充在这 是在select.php的最后
header("location:list.php");
就给一个算是抄袭的类给你吧,会不会用,就看你有没有前途了.<?php
class bookCart {
var $SortCount; //书品种数(包括0)
var $StyleCount; //书品种数(不包括0)
var $TotalCount; //书总册数
var $Id; //书的ID(数组)
var $Count; //每种书的册数(数组) //******构造函数
function GdbookCart(){
$this->SortCount=0;
session_start(); //初始化一个session
session_register('sId');
session_register('sCount'); $this->Update();
$this->Calculate();} //********私有,根据session的值更新类中相应数据
function Update(){
global $sId,$sCount; if(!isset($sId)) return; $this->Id=$sId;
$this->Count=$sCount;
$this->SortCount=count($sId); //品种数等于SESSION的个数
} //*************私有,根据新的数据计算总册数
function Calculate(){
for($i=0;$i<$this->SortCount;$i++){
$this->TotalCount += $this->Count[$i];
if($this->Count[$i]>0) $StyleCount++;
}
}//**************以下为接口函数 //*** 加一种书
// 判断是否蓝中已有,如有,加count,否则加一种新书
function AddOne($id){
global $sId,$sCount; $k=count($sId);
for($i=0;$i<$k;$i++){ //先找一下是否已经加入了这种书
if($sId[$i]==$id){
$sCount[$i]++;
break;
}
}
if($i>=$k){ //没有则加一个新书种类
$sId[]=$id;
$sCount[]=1;
} $this->Update(); //更新一下类的成员数据
$this->Calculate();
} //移去一件商品
function RemoveOne($id){
global $sId,$sCount; $k=count($sId);
for($i=0;$i<$k;$i++){
if($sId[$i]==$id){
$sCount[$i]--;
break;
}
} $this->Update();
$this->Calculate();
} //改变书的个数
function ModifyCount($i,$ncount){
global $sCount; $sCount[$i]=$ncount; $this->Update();
$this->Calculate();
} //清空一种书
function EmptyOne($i){
global $sCount; $sCount[$i]=0; $this->Update();
$this->Calculate();
}
/***************************
清空所有的书因为在win里PHP不支持session_destroy()函数,所以这个清空函数不完善,
只是把每种商品的个数置为0。
如果是在linux下,可以直接用session_destroy()来做。
*****************************/
function EmptyAllforWin(){
global $sId,$sCount; $k=count($sId);
for($i=0;$i<$k;$i++){
$sCount[$i]=0;
} $this->Update();
$this->Calculate();
session_unregister('sId');
session_unregister('sCount'); $this->SortCount=0; }
//linux下的清空购书蓝。
function EmptyAll() {
session_destroy();
}//是否某种书已在蓝内,参数为此书的ID
function InCart($id){
for($i=0;$i<$this->SortCount;$i++){
if($this->Id[$i]==$id) return TRUE;
}
return FALSE;
} //是否某种书在蓝内是否有书,参数为此书的ID
function HaveInCart($id){
for($i=0;$i<$this->SortCount;$i++){
if(($this->Id[$i]==$id)&&($this->Count[$i]>0)) return TRUE;
}
return FALSE;
} // if($this->Count[$i]>0) $StrId[]=$this->Id[$i];//测试购书蓝是否为空。返回BOOL值
function IsEmptyCart(){
if ($this->SortCount==0 or $this->TotalCount==0) {
return TRUE;
} else {
return FALSE;
}
}//某种书在蓝内的位置
function IndexOf($id){
for($i=0;$i<$this->SortCount;$i++){
if($this->Id[$i]==$id) return $i;
}
return 0;
} //取总的书种类数
function GetSortCount(){
return $this->SortCount;
} //取总册数
function GetTotalCount(){
return $this->TotalCount;
} //取一件商品的信息,主要的工作函数
//返回一个关联数组,下标分别对应 i(数组位置),count
function GetOne($i){
$Result[id]=$this->Id[$i];
$Result[count]=$this->Count[$i];
return $Result;
} function GetOneCount($i){
return $this->Count[$i];
}
//取购物蓝用“,”隔开的ID串
function GetQueryString(){
for($i=0;$i<$this->SortCount;$i++){
if($this->Count[$i]>0) $StrId[]=$this->Id[$i];
}
return join(",",$StrId);
}//end class
}
?>
不过,我要是沦落到靠copy别人的代码而有前途 我另愿不要有什么前途 谢谢关心~~祝你新年快乐~ 快过年了还在论坛上转,看的出你是个很用心的人.我的话有点偏激 在此 说声sorry ~
我不想因为一个小bug 而改变我所有的设计思想 这样不现实 况且我所有的程序都已经完成
现在只是在完善和测试找bug~~ 你的明白?
快过年了,我也不想“辛苦”了,祝你好运。88
看看是否执行到那里
$goods[$i] ?>">清除</a>这一行里少了一个&参数连接符
改为:<a href="select.php?action=del&$goods_id=<? echo
$goods[$i] ?>">清除</a>别的错误没细看,先试试吧。
原因是我把 $和& 写错了 ~~
正确的应该是:<a href="select.php?action=del&goods_id=<? echo
$goods[$i] ?>">清除</a>
惭愧~~~~ 我是经常犯这样的错误~~~ 有时候把自己搞的很郁闷! 怪我自己没仔细 唉~~ 谢谢.....