cart.php45行去掉后面的."
$query="select Productprice,Productname from Product where Productid=".$ProductID.";==>$query="select Productprice,Productname from Product where Productid=".$ProductID;

解决方案 »

  1.   

    1、cart.php
    $query="select Productprice,Productname from Product where Productid=".$ProductID.";
                     -----^ 这里的."不要
      

  2.   

    2、由于定义cart失败,所以报错
      

  3.   

    $count ===>>>> $this->count
      

  4.   

    在function add_item($ProductID)
    中有$count它是一个局部变量而非类的属性值,你可直接用$this->count;
    或者$count=$this->count;
      

  5.   

    pantech_36(*_*阿苯猫^_^)兄:
    你说的我不明白。    $this->count++;
        $this->Cartitme[$count]["productid"]=$ProductID;
        $this->Cartitme[$count]["qty"]=1;
        $this->Cartitme[$count]["price"]=$price;
        $this->Cartitme[$count]["productname"]=$pname;
    这几句怎么该啊?我这些都是一个字一个字抄来的。
      

  6.   

    $this->Cartitme[$this->count]["productid"]=$ProductID;
        $this->Cartitme[$this->count]["qty"]=1;
        $this->Cartitme[$this->count]["price"]=$price;
        $this->Cartitme[$this->count]["productname"]=$pname;
      

  7.   

    3、在function add_item($ProductID)中    $this->Cartitme[$count]["productid"]=$ProductID;
        $this->Cartitme[$count]["qty"]=1;
        $this->Cartitme[$count]["price"]=$price;
        $this->Cartitme[$count]["productname"]=$pname;
    改为
        $this->Cartitme[$this->count]["productid"]=$ProductID;
        $this->Cartitme[$this->count]["qty"]=1;
        $this->Cartitme[$this->count]["price"]=$price;
        $this->Cartitme[$this->count]["productname"]=$pname;
      

  8.   

    phpteam、 xuzuning(唠叨) 二位老兄:$query="select Productprice,Productname from Product where Productid=".$ProductID.";
                     -----^ 这里的."不要
    为什么我按你们说的做后,页面会出现几十行的
    Warning: Supplied argument is not a valid MySQL result resource in cart.php on line 48
    我估计是MySQL的版本问题或PHP的问题,我该如何解决?
      

  9.   

    为什么我在另一台电脑(WIN98+PHP4.1)上运行showproduct.php会出现下面的结果?好象代码没有编译,右击页面可以查看源文件,这是为什么?文件名:showproduct.php add_item($id); } else { $cart=new cart; $cart->add_item($id); } } $page=$page?$page:1; $productcount=getrownumber(); $pagesize=2; if($page>$productcount/2) { $pagesize=thelastnumber($productcount); } $msgs=GetMessages($page*2-2,$pagesize); echo "
    共有".($productcount/2+1)."页 现在是第".$page."页"; if($page!=1) echo "previous"; else echo "previous"; if($page!=($productcount/2+1)) echo "nexe"; else echo "next"; echo "跳到第页"; for($count=1;$count<=$msgs[0];$count++) { echo "
    --------------------------------------------------------------------------------
     "; echo "ProductID.".jpg width=150 height=200> "; echo " productname:".$msgs[$count]->ProductName." 
    "; echo " price:".$msgs[$count]->Price." 
    "; echo " 简介:".$msgs[$count]->Abstract." 
    "; echo " 详细介绍 放入购物车 
    "; } echo " 
    "; ?>