model - How to work with temporary tables in CakePHP2.x -
i read lot of other postings problem, don't know how solve it:
i read 2 tables , want combine them in 1 temporary table.
i tried, other users next code:
$tmpmodel = 'listtransactions'; $tmptable = 'list_transactions'; $this->listtransactions->query("create temporary table `".$tmptable ."` ( `id` int(11) not null, `user_id` int(11) not null, `sum` decimal(10,2) not null, `date` datetime not null, `class` enum('level1','level2','level3','out') not null default 'out', `program_id` int(11) null, `program_title` varchar(150) null, primary key (`id`) )" ); app::import('model', $tmpmodel); $this->loadmodel($tmpmodel);
table creation returns true, think table created. when want save data, "table doesn't exists"-error.
foreach ($payments $payment) { $this->listtransactions->create(); $this->listtransactions->set(array( 'id' => $payment['payments']['id'], 'sum' => $payment['payments']['sum'], 'date' => $payment['payments']['check_date'], 'class' => 'out', 'user_id' => $userid )); $this->listtransactions->save(); } error: sqlstate[42s02]: base of operations table or view not found: 1146 table 'list_transactions' doesn't exist sql query: select count(*) `count` `list_transactions` `listtransactions` `listtransactions`.`id` = '1'
please help :(
greetings m.
model cakephp-2.1 temp-tables
No comments:
Post a Comment