好的,所以出于某种原因,我只得到$ this->信息被发送到mysql数据库
ie:应该是这个
"UPDATE `shop_products` SET shopid = 1 WHERE id = 42"
但我得到了这个
"UPDATE `shop_products` SET 1 WHERE 42"
这是我正在使用的代码。 我不确定为什么这不起作用
public function addstoreproduct($id,$shopid,$categoryid,$productname,$description,$price,$rcb)
{
$this->id = $id;
$this->shopid = $shopid;
$this->categoryid = $categoryid;
$this->productname = $productname;
$this->descriptionid = $description;
$this->price = $price;
$this->rcb = $rcb;
mysql_query("UPDATE `shop_products` SET shopid = "+$this->shopid+" WHERE id = "+$this->id+"");
//$this->updatedb('shop_products','shopid='+$this->shopid+'','"id='+$this->id+'"');
}
答案 0 :(得分:2)
尝试
mysql_query("UPDATE shop_products SET shopid = " . $this->shopid . " WHERE id = " . $this->id);
答案 1 :(得分:0)
首先构建它时是否显示正确的查询...
public function addstoreproduct($id,$shopid,$categoryid,$productname,$description,$price,$rcb)
{
$this->id = $id;
$this->shopid = $shopid;
$this->categoryid = $categoryid;
$this->productname = $productname;
$this->descriptionid = $description;
$this->price = $price;
$this->rcb = $rcb;
$query = "UPDATE `shop_products` SET shopid = "+$this->shopid+" WHERE id = "+$this->id+"";
echo $query;
mysql_query($query);
//$this->updatedb('shop_products','shopid='+$this->shopid+'','"id='+$this->id+'"');
}