2つのテーブルを結合して、各項目に論理削除ボタンを付けたいです。
xamppでの作成中です
このソース自体は記述途中です。
<!DOCTYPE html> <html lang="ja"> <head> <meta http-equiv="Content-Type" content="text/html"; charset="UTF-8" /> <title>status</title> </head> <body> <h1>使用状況画面</h1> <p><input type="button" name="regist" onclick="location.href= 'registration.php'" value="新規登録"></p> <form method = "post" action ="change.php"> <table border = "1" width = "auto"> <tr> <th>設備No</th> <th>設備名</th> <th>使用者</th> <th>開始時間</th> <th>終了時間</th> <th>使用目的</th> <th>削除</th> </tr> <?php //PDO生成 $pdo = new PDO ('mysql:host=localhost;dbname=simplefacilityusesystem;charset=utf8', 'maint', '1qaz!QAZ'); //データベース接続 foreach ( $pdo->query ( 'select facility from status left join using facility_number' ) as $row ) { echo '<tr>'; echo '<td>', $row ['facility_number'], '</td>'; echo '<td>', $row ['facility_name'], '</td>'; echo '<td>', $row ['name'], '</td>' echo '<td>', $row ['start'], '</td>; echo '<td>', $row ['end'], '</td>; echo '<td>', $row ['purpose'], '</td>; echo '<td><input type="submit value="削除" name="flag">', $row [''], '</td>'; echo '<td><input type="hidden" name="id" value="<?=$row['id']?>"'; echo '</tr>'; echo "\n"; } if(isset($_POST["flag"])){ $sql="delete from status where "; $sql->execute; } ?> </table> </form> <br><p><input type="submit" onclick="location.href= 'menu.php'" value="前画面に戻る"></p> </body> </html>
回答1件
あなたの回答
tips
プレビュー