###前提・実現したいこと
ここに質問したいことを詳細に書いてください
PHPで就労移行支援での勤怠と就労移行支援提供実績記録表を登録した内容で印刷できるシステムを作成してます。
私はPHP初心者なのですが、今回は利用者さんが引越し等を行った際に登録内容をシステム責任者側からマイページの編集で変更できるようにしたいと考えています。
就労支援実績記録表
http://www.kaigo-wel.city.nagoya.jp/_files/00015271/syuroikosien_jisseki.pdf
###発生している問題・エラーメッセージ
今回のerrorですが、SQL文の書き方が良くないのか、このままだとユーザー全員分が表示されたり、セキュリティ的に良くないという状態になってます。これの直し方がよく分からず困っております。
PHPとMYSQLが得意な方よろしくお願いします
###該当のソースコード
//connection.php(データベース連携)userform.php(登録画面)からの出力結果 include ('connection.php');// $q = "SELECT company, id,password,last_name,first_name,gender,age,zip,prefecture,city, addressnam,bill,tell,fax,email,registration_date, id FROM users ORDER BY registration_date ASC"; /*$q =mysqli_query($dbc , "UPDATE `users` SET id='$id_user',company=[value-2], `first_name`=[value-3], `last_name`=[value-4], `tell`=[value-5], `fax`=[value-6], `email`=[value-7], `gender`=[value-8], `age`=[value-9], `zip`=[value-10], `prefecture`=[value-11], `city`=[value-12], `addressnam`=[value-13], `bill`=[value-14], `coments`=[value-15], `password`=[value-16], `registration_date`=[value-17] WHERE 1);*/ $r = mysqli_query($dbc, $q); $num = mysqli_num_rows($r); if ($num > 0) {//出力結果を一覧表示 echo "<br><div class='dbs'>"; echo "<table border > <tr> "; while ($row = mysqli_fetch_array($r)) { echo "<tr> <th><a href='edit_user.php?user_id =". $row['id']."'>編集</a></th>//編集で内容を変更 <th><a href='delete.php?user_id =".$row['id']."&fname=".$row['first_name']."&lname=".$row['last_name']."'>削除</a></th>//削除で内容を削除 <tr> <th colspan='2'>所属先企業名</th> <td> ".$row['company']."</td> </tr> <tr> <tr> <th colspan='2'>入社日と時間</th> <td> ".$row['registration_date']."</td> </tr> <tr> <th colspan='2'>会員番号</th> <td> ".$row['id']."</td> </tr> <tr> <tr> <th colspan='2'>所属先選択</th> <td> ".$row['id']."</td> </tr> <tr> <th colspan='2'>名前</th> <td>".$row['first_name']." ". $row['last_name']."</td> </tr> <tr> <th colspan='2'>年齢</th> <td> ".$row['age']."</td> </tr> <tr> <th colspan='2'>性別</th> <td> ".$row['gender']."</td> </tr> <tr> <th colspan='2'>パスワード</th> <td> ".$row['password']."</td> </tr> <th rowspan='3'>連絡先</th> <th>電話番号</th> <td> ".$row['tell']."</td> <tr> <th>FAX</th> <td> ".$row['fax']."</td> <tr> <th>メール</th> <td> ".$row['email']."</td> </tr> <tr> <th rowspan='5'>ご住所</th> <th>郵便番号</th > <td> ".$row['zip']."</td> </tr> <tr> <th >都道府県</th > <td> ".$row['prefecture']."</td> </tr> <tr> <th >市区町村</th > <td> ".$row['city']."</td> </tr> <tr> <th >番地番号</th > <td> ".$row['addressnam']."</td> </tr> <tr> <th >アパート・マンション</th > <td> ".$row['bill']."</td> </tr> <tr> <th colspan='2'>コメント</th> <td></textarea></td> </tr> </tr>"; } echo "</table>"; echo "</div><br>"; }else { echo "<p>There are currently no registrated users .</p>"; } mysqli_close($dbc); ?>
###試したこと
課題に対してアプローチしたことを記載してください
元のデータから表のレイアウトを変更してあります。
###補足情報(言語/FW/ツール等のバージョンなど)
php,phpMyAdmin