○現在の各状態
・各テーブル
users_infoテーブル
ユーザーの基本情報
days_infoテーブル
PHP側で指定してInsertした日付一覧
attendances_infoテーブル
各ユーザーのその日の勤怠状況
・PHPソース
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <link rel="stylesheet" type="text/css" href="AppStyle.css"> <title>勤怠状況</title> </head> <body> <?php //-- MySQL接続文省略 --// //ユーザー情報参照 $query = mysql_query('select * from users_info'); //PHP側で入力し指定した日付参照 $days = mysql_query('select days from days_info'); //各ユーザーの勤怠状況参照 $attendances = mysql_query('select attendances from attendances_info'); print("<div>"); print("<form method='POST' action='./RegistTabaleData.php'>"); print('<table border="1" align="center">'); print("<tr><th></th>"); //日付レコード参照 while ($row = mysql_fetch_array($days)) { print("<th>".$row['days']."</th>"); } print("</tr>"); //送信ボタン $button = "<input name='submission' type='submit' value='送信'/>"; //ユーザー名参照 while ($row = mysql_fetch_assoc($query)) { $user_name = $row['user_name']; print("<tr><td>".$user_name."</td>"); //-- ここが問題 --// //勤怠状況参照 while($day = mysql_fetch_assoc($attendances)){ $selectBox = "<select name='selects[]'><option>".$day["attendances"]."</option><option>早退</option><option>休暇</option><option>出勤</option>"; print("<td>".$selectBox."</td>"); } print("</tr>"); } print("<tr><td>".$button."</td></tr>"); print('</table>'); print("</form>"); print("</div>"); ?> </body> </html>
○質問
レコードを上記の画像のように区切ることがうまく行きません。
アルゴリズム的な問題かも知れませんが、やり方の問題もあるかと考えています。
どうすればうまく区切れるのか、、わかる方ご教授お願いします。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2016/05/21 03:20