2011-11-27 64 views
-1

嗨,我需要更新數據庫。我做了這個代碼,但它不工作:從OSCommerce Cookie更新MySQL字段

<?php 
if (isset($_COOKIE['credits_id'])) { 
tep_db_query("update " . TABLE_CUSTOMERS . " set credits+ WHERE customers_id='".mysql_real_escape_string($_COOKIE['credits_id']). "'"); 
} 
else 
{ 
echo 'fout'; 
} 
?> 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+ WHERE customers_id='17'' at line 1 

update customers set credits+ WHERE customers_id='17' 

[TEP STOP] 

它需要在表customers更新域credits。我怎樣才能做到這一點?

+0

使用這種類型的「認證」,每個人都可以提高所有學分。你確定你想要嗎? – str

回答

1

您更新查詢不正確:

 
"update " . TABLE_CUSTOMERS . " set credits = credits + $someNewValue WHERE customers_id='".mysql_real_escape_string($_COOKIE['credits_id']). "'" 

希望它可以幫助