登録されたデータを編集したい場合、
該当の項目の編集ページを表示させたい
<現状>
1ページ目の編集ボタンをクリックすると
エラー文が表示される。
<エラー内容>
php
1Warning: PDOStatement::execute(): SQLSTATE[HY093]: Invalid parameter number: no parameters were bound in /Applications/XAMPP/xamppfiles/htdocs/phpkiso/DB/DB_edit.php on line 52 2 3Fatal error: Call to undefined function print() in /Applications/XAMPP/xamppfiles/htdocs/phpkiso/DB/DB_edit.php on line 59 4
どうしても解決できず、皆様のお力をお借りしたい、と思い投稿させて頂きました。
宜しくお願い致します。
1ページ
<データ一覧>
php
1 2<?php 3 session_start(); 4 ?> 5<!DOCTYPE html> 6<html> 7 <head> 8 <meta charset="UTF-8"> 9 <title>顧客管理*一覧表</title> 10 <link rel="stylesheet" href="DB_color.css" class="e"> 11 </head> 12 <form action="DB_edit.php" name="form1" method="post"> 13 <body background="back.gif" bgcolor="#ccc" class="a"> 14 <h1>顧客管理一覧</h1> 15 <br /> 16 <br /> 17 <?php 18 $dsn = 'mysql:host=localhost;dbname=customer;charset=utf8'; 19 $user = 'root'; 20 $password = ''; 21 22 $dbh = new PDO($dsn,$user,$password); 23 $dbh->query('SET NAMES utf8'); 24 $sqlcmd = "SELECT * FROM `customer_member`"; 25 26 $statement = $dbh->prepare($sqlcmd); 27 $statement->execute(); 28 29 if($statement->execute()){ 30 $row_count = $statement->rowCount(); 31 while($row = $statement->fetch()){ 32 $rows[] = $row;} 33 }else{ 34 $errors['error'] = "検索失敗しました。"; 35 } 36 $dbh = null; 37 ?> 38 <input type="button" onclick="location.href='DB_top.php'" value="トップ戻る" name="botton1" class="main"> 39 <fieldset> 40 <?php foreach($rows as $row){ ?> 41 <fieldset> 42 <table id="main-category"> 43 <tr> 44 <td><input type="submit" value="編集" name="edit" class="main"></td> 45 <td><input type="button" onclick="location.href='DB_edit.php'" value="削除" name="botton1" class="main"></td> 46 </tr> 47 <tr> 48 <th>フリガナ</th> 49 <td><input type="text" value="<?php echo $row['hurigana']; ?>" class="d-na"></td> 50 </tr> 51 <tr> 52 <th>名 前</th> 53 <td><input type="text" value="<?php echo $row['name']; ?>" class="d-na"></td> 54 </tr> 55 <tr> 56 <th>性別</th> 57 <td><input type="text" value="<?php print $row['sex']; ?>" class="d-na"></td> 58 </tr> 59 <tr> 60 <th>郵便番号</th> 61 <td> 62 <input type="text" value="<?php print $row['post1']; ?>" class="d-i">- 63 <input type="text" value="<?php print $row['post2']; ?>" class="d-year"> 64 </td> 65 <tr> 66 <th>住 所</th> 67 <td><input type="text" value="<?php echo $row['adress']; ?>" class="d-ad"></td> 68 </tr> 69 <tr> 70 <th>電 話 番 号</th> 71 <td><input type="text" value="<?php echo $row['tell']; ?>" class="d-ad"></td> 72 <tr> 73 <th>E-MAIL</th> 74 <td><input type="text" value="<?php echo $row['email']; ?>" class="d-na"></td> 75 </tr> 76 <tr> 77 <th>生年月日</th> 78 <td> 79 <input type="text" value="<?php echo $row['birth']; ?>" class="d-year">年 80 <input type="text" value="<?php echo $row['birth_m']; ?>" class="d-i">月 81 <input type="text" value="<?php echo $row['birth_d']; ?>" class="d-i">日 82 <input type="text" value="<?php echo $row['hour']; ?>" class="d-i">時 83 <input type="text" value="<?php echo $row['minute']; ?>" class="d-i">分 84 </td> 85 </tr> 86 <tr> 87 <th>入 会 日 </th> 88 <td> 89 <input type="text" value="<?php echo $row['year1']; ?>" class="d-y">年 90 <input type="text" value="<?php echo $row['year2']; ?>" class="d-da">月 91 <input type="text" value="<?php echo $row['year3'] ;?>" class="d-da">日 92 </td> 93 </tr> 94 <tr> 95 <th>退 会 日 </th> 96 <td> 97 <input type="text" value="<?php echo $row['year01']; ?>" class="d-y">年 98 <input type="text" value="<?php echo $row['year02']; ?>" class="d-da">月 99 <input type="text" value="<?php echo $row['year03'] ;?>" class="d-da">日 100 </td> 101 </tr> 102 <tr> 103 <th>紹 介 者</th> 104 <td><input type="text" value="<?php print $row['syoukai']; ?>" class="d-na"></td> 105 <br> 106 </table> 107 </fieldset> 108 <?php }?> 109</fieldset> 110 <input type="button" onclick="location.href='DB_top.php'" value="トップ戻る" name="botton1" class="main"> 111</body> 112</html> 113
<編集ページ>
2ページ目
php
1<?php 2 session_start(); 3 ?> 4<!DOCTYPE html> 5<html> 6 <head> 7 <meta charset="UTF-8"> 8 <title>顧客管理*一覧表</title> 9 <link rel="stylesheet" href="DB_color.css" class="e"> 10 </head> 11 <form action="DB_main.php" name="form1" method="post"> 12 <body background="back.gif" bgcolor="#ccc" class="a"> 13 <h1>顧客管理一覧</h1> 14 <br /> 15 <br /> 16 <?php 17 18 $dsn = 'mysql:host=localhost;dbname=customer;charset=utf8'; 19 $user = 'root'; 20 $password = ''; 21 22 $dbh = new PDO($dsn,$user,$password); 23 $dbh->query('SET NAMES utf8'); 24 $sqlcmd = "SELECT * FROM `customer_member` WHERE code=?"; 25 26 27 $statement = $dbh->prepare($sqlcmd); 28 $statement->execute(); 29 30 $row_count = $statement->rowCount(); 31 32 if($row_count == 0){ 33 $ErrorTest = 'こちらの名前に該当するものはありません'; 34 print("$ErrorTest"); 35 } else { 36 while($row = $statement->fetch()) 37 { 38 $rows[] = $row; 39 } 40 print 'fff'; 41 $dbh = null; 42 print 'eee'; 43 ?> 44 <input type="button" onclick="location.href='DB_top.php'" value="トップ戻る" name="botton1" class="main"> 45 <fieldset> 46 <?php foreach((array)$rows as $row){ ?> 47 <fieldset> 48 <table id="main-category"> 49 <tr> 50 <th>フリガナ</th> 51 <td><input type="text" value="<?php echo $row['hurigana']; ?>" class="d-na"></td> 52 </tr> 53 <tr> 54 <th>名 前</th> 55 <td><input type="text" value="<?php echo $row['name']; ?>" class="d-na"></td> 56 </tr> 57 <tr> 58 <th>性別</th> 59 <td><input type="text" value="<?php print $row['sex']; ?>" class="d-na"></td> 60 </tr> 61 <tr> 62 <th>郵便番号</th> 63 <td> 64 <input type="text" value="<?php print $row['post1']; ?>" class="d-i">- 65 <input type="text" value="<?php print $row['post2']; ?>" class="d-year"> 66 </td> 67 <tr> 68 <th>住 所</th> 69 <td><input type="text" value="<?php echo $row['adress']; ?>" class="d-ad"></td> 70 </tr> 71 <tr> 72 <th>電 話 番 号</th> 73 <td><input type="text" value="<?php echo $row['tell']; ?>" class="d-ad"></td> 74 <tr> 75 <th>E-MAIL</th> 76 <td><input type="text" value="<?php echo $row['email']; ?>" class="d-na"></td> 77 </tr> 78 <tr> 79 <th>生年月日</th> 80 <td> 81 <input type="text" value="<?php echo $row['birth']; ?>" class="d-year">年 82 <input type="text" value="<?php echo $row['birth_m']; ?>" class="d-i">月 83 <input type="text" value="<?php echo $row['birth_d']; ?>" class="d-i">日 84 <input type="text" value="<?php echo $row['hour']; ?>" class="d-i">時 85 <input type="text" value="<?php echo $row['minute']; ?>" class="d-i">分 86 </td> 87 </tr> 88 <tr> 89 <th>入 会 日 </th> 90 <td> 91 <input type="text" value="<?php echo $row['year1']; ?>" class="d-y">年 92 <input type="text" value="<?php echo $row['year2']; ?>" class="d-da">月 93 <input type="text" value="<?php echo $row['year3'] ;?>" class="d-da">日 94 </td> 95 </tr> 96 <tr> 97 <th>退 会 日 </th> 98 <td> 99 <input type="text" value="<?php echo $row['year01']; ?>" class="d-y">年 100 <input type="text" value="<?php echo $row['year02']; ?>" class="d-da">月 101 <input type="text" value="<?php echo $row['year03'] ;?>" class="d-da">日 102 </td> 103 </tr> 104 <tr> 105 <th>紹 介 者</th> 106 <td><input type="text" value="<?php print $row['syoukai']; ?>" class="d-na"></td> 107 <br> 108 </table> 109 </fieldset> 110 <?php }}?> 111</fieldset> 112 <input type="button" onclick="location.href='DB_top.php'" value="トップ戻る" name="botton1" class="main"> 113</body> 114</html> 115 116 117