Welcome Guest, Not a member yet? Register   Sign In
Multi Query Problems in Codeigniter 3
#5

(This post was last modified: 07-11-2021, 06:36 AM by includebeer.)

(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


i want to run insert data and want to print the result of select , but why is the result boolean

Maybe you are looking for transactions?
PHP Code:
$this->db->transStart();
$this->db->query('AN SQL QUERY...');
$this->db->query('ANOTHER QUERY...');
$this->db->transComplete();

if (
$this->db->transStatus() === FALSE)
{
    // generate an error... or use the log_message() function to log your error


(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.
CodeIgniter 4 tutorials (EN/FR) - https://includebeer.com
/*** NO support in private message - Use the forum! ***/
Reply


Messages In This Thread
RE: Multi Query Problems in Codeigniter 3 - by includebeer - 07-11-2021, 06:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB