mysql - Insert query is not working in my php file -


i getting values csv file , inserting them sql tables.
trying insert(or replace). not working. when use update query works fine , updates values correctly.
not sure wrong in script.

$query_insert = " insert     `ps_product`     (          `id_product`         ,`id_supplier`         ,`id_manufacturer`         ,`id_category_default`         ,`id_shop_default`         ,`id_tax_rules_group`         ,`on_sale`         ,`online_only`         ,`ean13`         ,`upc`         ,`ecotax`         ,`quantity`         ,`minimal_quantity`         ,`price`         ,`wholesale_price`         ,`unity`         ,`unit_price_ratio`         ,`additional_shipping_cost`         ,`reference`         ,`supplier_reference`         ,`location`         ,`width`         ,`height`         ,`depth`         ,`weight`         ,`out_of_stock`         ,`quantity_discount`         ,`customizable`         ,`uploadable_files`         ,`text_fields`         ,`active`         ,`redirect_type`         ,`id_product_redirected`         ,`available_for_order`         ,`available_date`         ,`condition`         ,`show_price`         ,`indexed`         ,`visibility`         ,`cache_is_pack`         ,`cache_has_attachments`         ,`is_virtual`         ,`cache_default_attribute`         ,`date_add`         ,`date_upd`         ,`advanced_stock_management`     )     values     (          " .$id ."         ,'2'         ,'" .$id_manu ."'         ,'" .$categoryrec ."'         ,'2'         ,'2'         ,'0'         ,'0'         ,'" .$ean ."'         ,'" .$upc ."'         ,'0.000000'         ,'0'         ,'1'         ,'" .$retailp ."'         ,'" .$wholesalep ."'         ,''         ,'0.000000'         ,'0.00'         ,'" .$ref ."'         ,'" .$id ."'         ,''         ,'0.000000'         ,'0.000000'         ,'0.000000'         ,'0.000000'         ,'2'         ,'0'         ,'0'         ,'0'         ,'0'         ,'1'         ,''         ,'0'         ,'1'         ,'0000-00-00'         ,'new'         ,'1'         ,'1'         ,'both'         ,'0'         ,'0'         ,'0'         ,'0'         ,'" .$dateadded ."'         ,'" .$dateupdated ."'         ,'0'     ) ";  //  echo $query_insert;  mysql_query( $query_insert ,$conn ); 

but using same values update query works perfect. can see doing wrong here??

mysql_query("update `ps_product` set `id_supplier`=1,`id_manufacturer`=$id_manu,`id_category_default`=$categoryrec,`id_shop_default`=1,`id_tax_rules_group`=1,`on_sale`=0,`online_only`=0,`ean13`='$ean',`upc`='$upc',`ecotax`=0.000000,`quantity`=0,`minimal_quantity`=1,`price`='$retailp',`wholesale_price`='$wholesalep',`unity`='',`unit_price_ratio`=0.000000,`additional_shipping_cost`=0.00,`reference`='$ref',`supplier_reference`=$id,`location`='',`width`=0.000000,`height`=0.000000,`depth`=0.000000,`weight`=0.000000,`out_of_stock`=2,`quantity_discount`=0,`customizable`=0,`uploadable_files`=0,`text_fields`=0,`active`=1,`redirect_type`='',`id_product_redirected`=0,`available_for_order`=1,`available_date`='0000-00-00',`condition`='new',`show_price`=1,`indexed`=1,`visibility`='both',`cache_is_pack`=0,`cache_has_attachments`=0,`is_virtual`=0,`cache_default_attribute`=0,`date_add`='$dateadded',`date_upd`='$dateupdated',`advanced_stock_management`=0  `id_product`=$id",$conn);   

i must mention product entering not in table , product updating in system. have tested.

online_only isn't quoted properly


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -