Topic: Item Edit - Fix error
Hello,
I have seen error when updating any item ,
**************
DATABASE ERROR : The item could not be updated
error code : 1064
error message : 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 'no_sale='0' WHERE stock_id='-1'' at line 12
sql that failed was : UPDATE 0_stock_master SET long_description='', description='Disciunt0', category_id='2', sales_account='4510', inventory_account='1510', cogs_account='5010', adjustment_account='5040', assembly_account='1530', dimension_id='0', dimension2_id='0', tax_type_id='1' no_sale='0' WHERE stock_id='-1'
*************
I have fixed as the following
inventory/manage/items.php
go to line 17 ,
$sql = "UPDATE ".TB_PREF."stock_master SET long_description=".db_escape($long_description).",
description=".db_escape($description).",
category_id=".db_escape($category_id).",
sales_account=".db_escape($sales_account).",
inventory_account=".db_escape($inventory_account).",
cogs_account=".db_escape($cogs_account).",
adjustment_account=".db_escape($adjustment_account).",
assembly_account=".db_escape($assembly_account).",
dimension_id=".db_escape($dimension_id).",
dimension2_id=".db_escape($dimension2_id).",
tax_type_id=".db_escape($tax_type_id)."
no_sale=".db_escape($no_sale);
replaced by
$sql = "UPDATE ".TB_PREF."stock_master SET long_description=".db_escape($long_description).",
description=".db_escape($description).",
category_id=".db_escape($category_id).",
sales_account=".db_escape($sales_account).",
inventory_account=".db_escape($inventory_account).",
cogs_account=".db_escape($cogs_account).",
adjustment_account=".db_escape($adjustment_account).",
assembly_account=".db_escape($assembly_account).",
dimension_id=".db_escape($dimension_id).",
dimension2_id=".db_escape($dimension2_id).",
tax_type_id=".db_escape($tax_type_id).",
no_sale=".db_escape($no_sale);
the error was because there is no , after tax_type_id=".db_escape($tax_type_id)."