2014-10-01 85 views
0

我有一個奇怪而難以理解的情況。我無法用我的php腳本中的查詢更新ENUM字段。在海蒂執行,它完美的作品。有人能幫我理解爲什麼嗎?更新MySQL中的ENUM字段

這是查詢:

UPDATE ps_specific_price 
SET reduction='0.5', reduction_type='percentage' 
WHERE id_product='249' and id_group='3' 

枚舉字段是reduction_type(數量,百分比)

下面是操作的代碼:

if($valori['perc_riv']==0){ 
    $sql_perc_riv="update ps_specific_price set reduction='0', reduction_type='amount' where id_product='".$valori[id_product]."' and id_group='3'"; 
} else { 
    $riduzione=(float)$valori['perc_riv']/100; 
    $sql_perc_riv="update ps_specific_price set reduction_type='percentage' WHERE id_specific_price='2031'"; // where id_product='".$valori[id_product]."' and id_group='3'"; 
} 
    $sttpercriv = $conn->prepare($sql_perc_riv); 
    $sttpercriv->execute(); 
+0

請發佈您的PHP代碼 – 2014-10-01 10:52:48

+0

你得到的錯誤是什麼 – 2014-10-01 10:53:01

+0

我沒有錯誤。就像查詢跳過了...呃... – fsalvaggio 2014-10-01 10:59:12

回答

0

好吧,我看了好該文件:我必須做一個Alter表。我不'想要。我將進行選擇,然後刪除該行,然後使用不同的值創建新的插入。