How to save a fcolumn with “/” using CakePHP Table save method? [duplicate]












0
















This question already has an answer here:




  • how to add ` character to sql queries in cakephp 3

    2 answers




Here is my code:



$conn = CakeDatasourceConnectionManager::get('default');
$conn->logQueries(true);
$entities = $this->patchEntity($entity, $insertData);
$this->saveMany($entities);


And its generating the following insert header:



INSERT INTO aneel_sdi_razao_sintetico (Ide_RO_Sintetico, Cd_ODI, Cd_SubODI, Txt_Desc_ODI, Nr_TI, Txt_Tipo_Obra, Txt_Class_Obra, Vl_UC/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_ST, Vl_Proj_MOP, Vl_Mont_MOP, Vl_Frete_MOP, Vl_Fis_MOP, Vl_Sup_MOP, Vl_Ger_MOP, Vl_Tot_CA, Vl_JOA, Vl_Outros, Vl_Tot_Proj, Dt_Ini_Proj, Dt_Energ, Dt_Uniti, Pct_OE, txt_PLPT_OE, txt_Doa_OE, txt_Incor_OE, Nr_Fases, SDI_importacoes_id) VALUES ...



And the following error:



SQLSTATE[42000]: Syntax error or access violation: 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 '/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_' at line 1



The problem is the field "Vl_UC/UAR" must have this "/" and i don't know how to place the "`" character to make the MySQL accept it.



Someone know how to make it work?










share|improve this question













marked as duplicate by Community Nov 22 '18 at 13:13


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.























    0
















    This question already has an answer here:




    • how to add ` character to sql queries in cakephp 3

      2 answers




    Here is my code:



    $conn = CakeDatasourceConnectionManager::get('default');
    $conn->logQueries(true);
    $entities = $this->patchEntity($entity, $insertData);
    $this->saveMany($entities);


    And its generating the following insert header:



    INSERT INTO aneel_sdi_razao_sintetico (Ide_RO_Sintetico, Cd_ODI, Cd_SubODI, Txt_Desc_ODI, Nr_TI, Txt_Tipo_Obra, Txt_Class_Obra, Vl_UC/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_ST, Vl_Proj_MOP, Vl_Mont_MOP, Vl_Frete_MOP, Vl_Fis_MOP, Vl_Sup_MOP, Vl_Ger_MOP, Vl_Tot_CA, Vl_JOA, Vl_Outros, Vl_Tot_Proj, Dt_Ini_Proj, Dt_Energ, Dt_Uniti, Pct_OE, txt_PLPT_OE, txt_Doa_OE, txt_Incor_OE, Nr_Fases, SDI_importacoes_id) VALUES ...



    And the following error:



    SQLSTATE[42000]: Syntax error or access violation: 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 '/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_' at line 1



    The problem is the field "Vl_UC/UAR" must have this "/" and i don't know how to place the "`" character to make the MySQL accept it.



    Someone know how to make it work?










    share|improve this question













    marked as duplicate by Community Nov 22 '18 at 13:13


    This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.





















      0












      0








      0









      This question already has an answer here:




      • how to add ` character to sql queries in cakephp 3

        2 answers




      Here is my code:



      $conn = CakeDatasourceConnectionManager::get('default');
      $conn->logQueries(true);
      $entities = $this->patchEntity($entity, $insertData);
      $this->saveMany($entities);


      And its generating the following insert header:



      INSERT INTO aneel_sdi_razao_sintetico (Ide_RO_Sintetico, Cd_ODI, Cd_SubODI, Txt_Desc_ODI, Nr_TI, Txt_Tipo_Obra, Txt_Class_Obra, Vl_UC/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_ST, Vl_Proj_MOP, Vl_Mont_MOP, Vl_Frete_MOP, Vl_Fis_MOP, Vl_Sup_MOP, Vl_Ger_MOP, Vl_Tot_CA, Vl_JOA, Vl_Outros, Vl_Tot_Proj, Dt_Ini_Proj, Dt_Energ, Dt_Uniti, Pct_OE, txt_PLPT_OE, txt_Doa_OE, txt_Incor_OE, Nr_Fases, SDI_importacoes_id) VALUES ...



      And the following error:



      SQLSTATE[42000]: Syntax error or access violation: 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 '/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_' at line 1



      The problem is the field "Vl_UC/UAR" must have this "/" and i don't know how to place the "`" character to make the MySQL accept it.



      Someone know how to make it work?










      share|improve this question















      This question already has an answer here:




      • how to add ` character to sql queries in cakephp 3

        2 answers




      Here is my code:



      $conn = CakeDatasourceConnectionManager::get('default');
      $conn->logQueries(true);
      $entities = $this->patchEntity($entity, $insertData);
      $this->saveMany($entities);


      And its generating the following insert header:



      INSERT INTO aneel_sdi_razao_sintetico (Ide_RO_Sintetico, Cd_ODI, Cd_SubODI, Txt_Desc_ODI, Nr_TI, Txt_Tipo_Obra, Txt_Class_Obra, Vl_UC/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_ST, Vl_Proj_MOP, Vl_Mont_MOP, Vl_Frete_MOP, Vl_Fis_MOP, Vl_Sup_MOP, Vl_Ger_MOP, Vl_Tot_CA, Vl_JOA, Vl_Outros, Vl_Tot_Proj, Dt_Ini_Proj, Dt_Energ, Dt_Uniti, Pct_OE, txt_PLPT_OE, txt_Doa_OE, txt_Incor_OE, Nr_Fases, SDI_importacoes_id) VALUES ...



      And the following error:



      SQLSTATE[42000]: Syntax error or access violation: 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 '/UAR, Vl_COM, Vl_Proj_ST, Vl_Mont_ST, Vl_Frete_ST, Vl_Fis_ST, Vl_Sup_ST, Vl_Ger_' at line 1



      The problem is the field "Vl_UC/UAR" must have this "/" and i don't know how to place the "`" character to make the MySQL accept it.



      Someone know how to make it work?





      This question already has an answer here:




      • how to add ` character to sql queries in cakephp 3

        2 answers








      php mysql cakephp-3.0






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 21 '18 at 23:55









      Syan SouzaSyan Souza

      856




      856




      marked as duplicate by Community Nov 22 '18 at 13:13


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









      marked as duplicate by Community Nov 22 '18 at 13:13


      This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


























          1 Answer
          1






          active

          oldest

          votes


















          0














          If a column contains a / it needs to be quoted and the backtick is an subshell in PHP so:



          `Vl_UC/UAR`


          However its probably easier to rename the column.






          share|improve this answer
























          • Yes, but how can i do it using the cake save method?

            – Syan Souza
            Nov 22 '18 at 13:11


















          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          If a column contains a / it needs to be quoted and the backtick is an subshell in PHP so:



          `Vl_UC/UAR`


          However its probably easier to rename the column.






          share|improve this answer
























          • Yes, but how can i do it using the cake save method?

            – Syan Souza
            Nov 22 '18 at 13:11
















          0














          If a column contains a / it needs to be quoted and the backtick is an subshell in PHP so:



          `Vl_UC/UAR`


          However its probably easier to rename the column.






          share|improve this answer
























          • Yes, but how can i do it using the cake save method?

            – Syan Souza
            Nov 22 '18 at 13:11














          0












          0








          0







          If a column contains a / it needs to be quoted and the backtick is an subshell in PHP so:



          `Vl_UC/UAR`


          However its probably easier to rename the column.






          share|improve this answer













          If a column contains a / it needs to be quoted and the backtick is an subshell in PHP so:



          `Vl_UC/UAR`


          However its probably easier to rename the column.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 22 '18 at 0:12









          danblackdanblack

          2,0881317




          2,0881317













          • Yes, but how can i do it using the cake save method?

            – Syan Souza
            Nov 22 '18 at 13:11



















          • Yes, but how can i do it using the cake save method?

            – Syan Souza
            Nov 22 '18 at 13:11

















          Yes, but how can i do it using the cake save method?

          – Syan Souza
          Nov 22 '18 at 13:11





          Yes, but how can i do it using the cake save method?

          – Syan Souza
          Nov 22 '18 at 13:11





          Popular posts from this blog

          If I really need a card on my start hand, how many mulligans make sense? [duplicate]

          Alcedinidae

          Can an atomic nucleus contain both particles and antiparticles? [duplicate]