Welcome Guest, Not a member yet? Register   Sign In
can temporary tables be used in PHP?

(This post was last modified: 09-25-2022, 12:38 PM by richb201.)

Here is the code that I run under CI3. Is CI 3 still supported?
        $this->db->query('DROP TABLE IF EXISTS BC_PR_list_temp');
        $sql = "CREATE TEMPORARY TABLE BC_PR_list_temp(
                  taxyear  VARCHAR(10),
                  employee_email VARCHAR(80),
                  employee  VARCHAR(80),       
                  qualified_dollars int NOT NULL,
                  title varchar(80),
                  role varchar(80),
                  num_BC int NOT NULL,
                  num_PR int NOT NULL,
                  tipe varchar(4),
                  item varchar(80),
                  dollarsPerBC int NOT NULL,
                  dollarsPerPR int NOT NULL,
                  business_component_string varchar(120),
                  project_string varchar(120),
                  CONSTRAINT ONLYONE UNIQUE(employee_email, item, qualified_dollars)

        if ( ! $iRc)
            $error = $this->db->error(); // Has keys 'code' and 'message'
        if (!$this->db->table_exists('BC_PR_list_temp'))
            $error = $this->db->error(); // Has keys 'code' and 'message'
I am checking to see if the temp file sql call fails. It does not.  Then I check to see if the file was created. It was not. So then I copied the sql ONLY and pasted it directly in mysqlWorkBench and executed it I do not get an error so I assume it worked.

So the same code that fails to create a temp file under CI3, works under mysqlWorkBench. To see if it really worked I then run "table_exists('BC_PR_list_temp')" in mysqlWorkbench. But running that fails with "table_exists is not valid at this position."

So I don't know if it was created.
proof that an old dog can learn new tricks

Messages In This Thread
RE: can temporary tables be used in PHP? - by richb201 - 09-25-2022, 12:35 PM

Theme © iAndrew 2016 - Forum software by © MyBB