回答編集履歴

2

追記

2016/06/29 05:17

投稿

earnest_gay
earnest_gay

スコア615

test CHANGED
@@ -38,7 +38,7 @@
38
38
 
39
39
 
40
40
 
41
- $sql = "INSERT INTO Aテーブル(customer_name, prospective_client,recommended_product,recommended_points,entry_date ) VALUES (?, ?, ?, ?, ?)";
41
+ $sql = "INSERT INTO Bテーブル(customer_name, prospective_client,recommended_product,recommended_points,entry_date ) VALUES (?, ?, ?, ?, ?)";
42
42
 
43
43
 
44
44
 
@@ -59,3 +59,7 @@
59
59
  ]);
60
60
 
61
61
  ```
62
+
63
+
64
+
65
+ WHERE id = ???の分部は、セッションとかで割り当てればいいと思います。

1

追記

2016/06/29 05:17

投稿

earnest_gay
earnest_gay

スコア615

test CHANGED
@@ -3,3 +3,59 @@
3
3
 
4
4
 
5
5
  Aテーブルのdescriptionを取り出してBテーブルのrecommended_pointsにinsertすればよいのではないでしょうか?
6
+
7
+
8
+
9
+ イメージとしてはこんなところですかね?未検証ですが...
10
+
11
+
12
+
13
+ ```ここに言語を入力
14
+
15
+ $sql = "INSERT INTO Aテーブル(product_name,release_date,description ) VALUES (?, ?, ?)";
16
+
17
+
18
+
19
+ $stmt = $pdo->prepare($sql);
20
+
21
+ $stmt->execute([
22
+
23
+ product_nameに入れたい内容,
24
+
25
+ release_dateに入れたい内容,
26
+
27
+ descriptionに入れたい内容
28
+
29
+ ]);
30
+
31
+
32
+
33
+ $stmt = $pdo->query("SELECT description FROM Aテーブル WHERE id = ??? ");
34
+
35
+ $row = $stmt->fetch();
36
+
37
+ $description = $row['description '];
38
+
39
+
40
+
41
+ $sql = "INSERT INTO Aテーブル(customer_name, prospective_client,recommended_product,recommended_points,entry_date ) VALUES (?, ?, ?, ?, ?)";
42
+
43
+
44
+
45
+ $stmt = $pdo->prepare($sql);
46
+
47
+ $stmt->execute([
48
+
49
+ customer_nameに入れたい内容,
50
+
51
+ prospective_clientに入れたい内容,
52
+
53
+ recommended_productに入れたい内容,
54
+
55
+ $description,
56
+
57
+ entry_dateに入れたい内容
58
+
59
+ ]);
60
+
61
+ ```