1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24 |
cakephp 1.17 & 1.18
<?php
$query = 'INSERT INTO experiment_tools SET '.$fields;
$this->Experiment->execute($query);
echo $query;
$db =& ConnectionManager::getDataSource('cnm_experiments');
$tool_id = $db->lastInsertId();
$tool_id = $this->Experiment->query('SELECT LAST_INSERT_ID() AS insertID');
pr($tool_id[0][0]);
?>
outputs:
INSERT INTO experiment_tools SET experiment_id=1, tool_name="Lightsaber", manufacturer="Jedi Alliance", safeguards="test", inactive_flag="N"
string(1) "0"
Array
(
[insertID] => 8
)
|
