回答編集履歴
3
見直し
test
CHANGED
@@ -13,3 +13,15 @@
|
|
13
13
|
PDO接続しているときなら、PDOにまかせてこっちを使うのがいいかもしれない。
|
14
14
|
|
15
15
|
[PHP: PDO::lastInsertId - Manual](https://www.php.net/manual/ja/pdo.lastinsertid.php)
|
16
|
+
|
17
|
+
|
18
|
+
|
19
|
+
recipテーブルへのinsert into
|
20
|
+
|
21
|
+
↓
|
22
|
+
|
23
|
+
lastInsertId()にてauto_incrementなidを取得
|
24
|
+
|
25
|
+
↓
|
26
|
+
|
27
|
+
materialテーブルへのinsert intoに使う
|
2
見直し
test
CHANGED
@@ -7,3 +7,9 @@
|
|
7
7
|
|
8
8
|
|
9
9
|
[ LAST_INSERT_ID()、LAST_INSERT_ID(expr)](https://dev.mysql.com/doc/refman/5.6/ja/information-functions.html#function_last-insert-id)
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
PDO接続しているときなら、PDOにまかせてこっちを使うのがいいかもしれない。
|
14
|
+
|
15
|
+
[PHP: PDO::lastInsertId - Manual](https://www.php.net/manual/ja/pdo.lastinsertid.php)
|
1
訂正
test
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
reciep.idをautoincrementで設定しているなら、
|
1
|
+
reciep.idをauto_incrementで設定しているなら、
|
2
2
|
|
3
|
-
last_insert_id()で取得できると思うので、
|
3
|
+
select last_insert_id() from reciep; で取得できると思うので、
|
4
4
|
|
5
5
|
最後に自動設定されたreciep.idを取得したのをmaterialへのinsert into文で使えばいいじゃない。
|
6
6
|
|