質問編集履歴

1

「色」項目を追加 のSQL文の括弧とクォーテーションの誤りを修正しました

2022/06/20 08:30

投稿

Okam0chan
Okam0chan

スコア11

test CHANGED
File without changes
test CHANGED
@@ -21,8 +21,8 @@
21
21
  ```php
22
22
  //$colors…チェックボックス「色」の入力値を格納した配列。
23
23
  $sql = "SELECT * FROM clothes WHERE
24
- user IN (" . implode(',', array_fill(0, count($users), '?')) . "AND
24
+ user IN (" . implode(',', array_fill(0, count($users), '?')) . ") AND
25
- color IN (" . implode(',', array_fill(0, count($colors), '?')) .")'"; //追加
25
+ color IN (" . implode(',', array_fill(0, count($colors), '?')) .")"; //追加
26
26
  $stmt = $dbh->prepare($sql);
27
27
  $stmt->bind_param(str_repeat('s', count($users)), ...$users); //←78行目でエラー
28
28
  $stmt->bind_param(str_repeat('s', count($colors)), ...$colors); //追加