2
が今はネストwhile
ループとPHPとif-else
条件テーブルのリストを構築したい、コードのフォーマットは以下の通りである:PHPでテーブルを2つに分割してエコーするにはどうすればいいですか?
while(){
if(){
..... // extract the data
while(){
construct a table using the data extracted above
}
}
elseif(){
..... // extract the data
while(){
construct a table using the data extracted above
}
}
}
具体的には、内部ループコードがあるとき:
while ($chat = mysqli_fetch_assoc($chatQ))
{
echo
"<table class='table table-hover' >"
."<td>"
.$conver['sender_name']."\t".$chat['sender']."\t".$chat['send_time']."\t".$chat['content']
."</td>"
."<td>"
."<form id='join' action='group_chat.php' method ='POST' accept-charset='UTF-8'>"
// post the group id
."<input type='hidden' name='group_id' id='group_id' value=".$conver['sender_id']."/>"
."<button class='btn btn-default' type='submit'>Enter</button>"
."</form>"
."</td>"
."</table>";
}
問題がEnter
ボタンが関連付けられていることですメッセージごとにしかし、私が望むのは、すべてのメッセージを表示した後、特定のグループに誘導できるEnter
ボタンがあるということです。しかし、私はコードをどのように分離するのか分かりません。私に恵まれてください。前もって感謝します!