Multi Query Problems in Codeigniter 3 |
I want to ask about the CI3 problem.
Why in Codeigniter 3 can't run multi query with select statement I tried to Code: var_dump($get) This is my code : PHP Code: $get = $this->db->query("
Because that's not a valid SQL query. That's 2 queries. Why don't you run them one after the other? What are you trying to do?
not separated because I'm actually using a store procedure . Inside the stored procedure, there must be many queries
i want to run insert data and want to print the result of select , but why is the result boolean
@includebeer It's possible to run a insert on a select, but the amount of columns must match for this.
@sultantaspusat Are you trying to copy from the select to the insert or do you want something else?
(07-09-2021, 08:20 PM)sultantaspusat Wrote: not separated because I'm actually using a store procedure . Inside the stored procedure, there must be many queries Maybe you are looking for transactions? PHP Code: $this->db->transStart(); (07-11-2021, 02:32 AM)superior Wrote: @includebeer It's possible to run a insert on a select, but the amount of columns must match for this. Yes, but that's not the case here. He's doing an insert, then a select. I don't understand what different result he's expecting by doing it that way... As to why the result is boolean, that's because the insert is a "write" operation. See this page of the user guide. Quote:The query() function returns a database result object when “read” type queries are run which you can use to show your results. When “write” type queries are run it simply returns TRUE or FALSE depending on success or failure.
@includebeer the order for this is correct, the column count depends on this, so calling all columns should match the insert.
see: https://dev.mysql.com/doc/refman/8.0/en/...elect.html
(07-11-2021, 07:07 AM)superior Wrote: @includebeer the order for this is correct, the column count depends on this, so calling all columns should match the insert.I know you can insert the result of a select, but that's not what he's doing here...
[quote pid="388450" dateline="1625995947"]
i even want more than one select in store procedure , and how to get data from 3 table in the below, For Example : PHP Code: select * from tableA [/quote]
Then do 3 separate select. What are you trying to do that won’t work with separate queries? Maybe show us some code. For someone looking for help, you are not very collaborative…
[quote pid="388512" dateline="1626203444"]
Sorry in advance, maybe you don't understand what I mean. I use multi query inside Store Procedure the underlined word is store procedure [/quote] |
Welcome Guest, Not a member yet? Register Sign In |