mysql - execute multiple query with temp table in php -
I have the following query, to copy one line to the table and make changes in some columns.
Make a temporary table as temp_table * Table 1 to WHERE offertecode = '1c12a23453453458e492230df420 972'; UPDATE temp_table SET offertecode = '82a24c7da2342423424351804ab043', id = NULL, reference = '[copy] subject'; Include in Table 1 SELECT * FROM temp_table; Drop temporary table temp_table; This works perfectly well in phpmyadmin, but I can not do it from within PHP, I get an error:
You have an error in SQL syntax; Check the manual that matches your MySQL server version for the correct syntax to use on the 'UPDATE temp_table SET offertecode =' 82a24c7da234242342435180420043 ', id =' line 5. To execute this query in PHP? PHP Code:
$ mysqli-> Query ("Create temporary table as temp_table * WHERE offertecode = '1c12a23453453458e492230df420972' from table 1; Update temp_table SET offertecode = '82a24c7da2342423424351804ab043', id = NULL, reference = '[copy] subject'; Insert in table 1 Select * temp_table; temp_table drop temp table;); Thanks!
This does not solve mysqli problem (which has four statements in the same question). You should run them separately. But, you do not need four statements. Simply do:
Include in Table 1 (offrode, id, context, & lt; rest column & gt;) as '82a24c7da2342423424351804ab043' as the proposer, zero as id, references As a '[Copy] topic' & Lt; The rest of the column & gt; From Table 1 where offertecode = '1c12a23453453458e492230df420 972'; Insert a . . Selection can refer to the same table in both parts. Even in MySQL as well
Comments
Post a Comment