質問するログイン新規登録

質問編集履歴

4

\$data = mysqli_fetch_assoc\(\$recordSet\);が必要なかったので削除

2017/01/06 12:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -37,13 +37,12 @@
37
37
  mysqli_real_escape_string($db, $id)
38
38
  );
39
39
  $recordSet = mysqli_query($db, $sql);
40
- $data = mysqli_fetch_assoc($recordSet);
41
40
  ?>
42
41
 
43
42
  <select name="information">
44
43
  <?php
45
- while($data2 = mysqli_fetch_assoc($recordSet)) {
44
+ while($data = mysqli_fetch_assoc($recordSet)) {
46
- print '<option value="' . htmlspecialchars($data2['photo'], ENT_QUOTES) . '">' . htmlspecialchars($data2['photo'], ENT_QUOTES) . '</option>' . PHP_EOL;
45
+ print '<option value="' . htmlspecialchars($data['photo'], ENT_QUOTES) . '">' . htmlspecialchars($data['photo'], ENT_QUOTES) . '</option>' . PHP_EOL;
47
46
  }
48
47
  ?>
49
48
  </select>

3

selectの\*を詳細に

2017/01/06 12:16

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -33,7 +33,7 @@
33
33
  <?php
34
34
  require('dbconnect.php');
35
35
  $id = $_REQUEST['id'];
36
- $sql = sprintf("SELECT * FROM staff WHERE id=%d",
36
+ $sql = sprintf("SELECT name, age, phone, address, info FROM staff WHERE id=%d",
37
37
  mysqli_real_escape_string($db, $id)
38
38
  );
39
39
  $recordSet = mysqli_query($db, $sql);

2

sqlをsqliに統一

2017/01/06 11:56

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -42,7 +42,7 @@
42
42
 
43
43
  <select name="information">
44
44
  <?php
45
- while($data2 = mysql_fetch_assoc($recordSet)) {
45
+ while($data2 = mysqli_fetch_assoc($recordSet)) {
46
46
  print '<option value="' . htmlspecialchars($data2['photo'], ENT_QUOTES) . '">' . htmlspecialchars($data2['photo'], ENT_QUOTES) . '</option>' . PHP_EOL;
47
47
  }
48
48
  ?>

1

<select name="photo">を<select name="information">に修正

2017/01/06 11:52

投稿

退会済みユーザー
title CHANGED
File without changes
body CHANGED
@@ -40,7 +40,7 @@
40
40
  $data = mysqli_fetch_assoc($recordSet);
41
41
  ?>
42
42
 
43
- <select name="photo">
43
+ <select name="information">
44
44
  <?php
45
45
  while($data2 = mysql_fetch_assoc($recordSet)) {
46
46
  print '<option value="' . htmlspecialchars($data2['photo'], ENT_QUOTES) . '">' . htmlspecialchars($data2['photo'], ENT_QUOTES) . '</option>' . PHP_EOL;