質問編集履歴

1

②で乗せるコードを間違えていたので、更新しました。

2022/10/12 01:27

投稿

RAKUDA
RAKUDA

スコア10

test CHANGED
File without changes
test CHANGED
@@ -40,6 +40,7 @@
40
40
  }
41
41
  ?>
42
42
  <?php require '../footer.php'; ?>
43
+
43
44
 
44
45
  <?php session_start(); ?>
45
46
  <?php require '../header.php'; ?>
@@ -48,8 +49,8 @@
48
49
  unset($_SESSION['customer']);
49
50
  $pdo=new PDO('mysql:host=localhost;dbname=shop;charset=utf8',
50
51
  'staff', 'password');
51
- $sql=$pdo->prepare('select * from customer where login=? and password=?');
52
+ $row=$pdo->prepare('select * from customer where login=? and password=?');
52
- $row=$sql->execute([$_REQUEST['login'], $_REQUEST['password']]);
53
+ $row->execute([$_REQUEST['login'], $_REQUEST['password']]);
53
54
 
54
55
  $_SESSION['customer']=[
55
56
  'id'=>$row['id'], 'name'=>$row['name'],