php - Create table and use it - Codeigniter -
I am facing a very strange thing using CI,
I Make a table using the DBforge class, all is well and the table is actually built on my DB.
However, when I try to use the newly created table (insert, check that exists etc.) I have nowhere to get the following simple code: (Both are inside the work model)
function create_modules_table ($ tablename) {$ fields = array ('module_name' = & gt; array ('type' = & gt; 'VARCHAR', 'constraint = & gt; 100' '),' Position '= & gt; array (' type '= & gt;' VARCHAR ',' constraint = 'gt;' 100 ');); $ This- & gt; Dbforge-> Add_key ('module_name', TRUE); $ This- & gt; Dbforge-> Add_field ($ sectors); $$ --- gt; Dbforge-> Return_table ($ tablename); } A
function is followed by table_exists ($ table) {back to $ this- & gt; Db- & gt; Table_exists ($ table); } If I run
$ this-> Create_modules_table ('table'); $ Answer = $ this- & gt; Table_exists ('table'); It is revealed that $ North is returning false . I am checking my DB - the table is certain, 100% work is fine.
So I run the code again without removing the table from DB, now the answer is correct . The first run always fails in the check, as the CI does not know that there has been some change in DB. ** Is it going to be highlighted here? **
You can see the solution in.
This is a CI bug that does not update data_cache after creating a new table by DB_forge.
Comments
Post a Comment