Php While循环用于使用创建收件箱表,但它始终显示第一条消息
我使用while loop和bootstrap模式创建了一个邮件收件箱表,但它始终显示第一条邮件。我是mysql和php的新手。需要帮助我添加了一个图标当一些用户点击该图标时,它会给出另一个包含消息详细信息的模式框Php While循环用于使用创建收件箱表,但它始终显示第一条消息,php,mysql,twitter-bootstrap,bootstrap-modal,Php,Mysql,Twitter Bootstrap,Bootstrap Modal,我使用while loop和bootstrap模式创建了一个邮件收件箱表,但它始终显示第一条邮件。我是mysql和php的新手。需要帮助我添加了一个图标当一些用户点击该图标时,它会给出另一个包含消息详细信息的模式框 <!-- Start Inbox modal --> <div id="inbox_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalL
<!-- Start Inbox modal -->
<div id="inbox_modal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
include 'sql.php';
$SQL = "SELECT * FROM messaging WHERE to_receiver = '$user' ORDER BY date_send DESC";
$result = mysql_query($SQL);
while ($db_field = mysql_fetch_assoc($result)) {
$ctrl = $db_field['ctrl_no'];
$a = $db_field['opened'];
$b = $db_field['from_sender'];
$c = $db_field['mail_subject'];
$d = $db_field['date_send'];
?><tr>
<td><a data-toggle="modal" data-target="#read_mail" href="read_mail<?php print ".$ctrl."; ?>"><i class="<?php if ($a == 0) { echo'icon-lock';} else{echo'icon-unlock';} ?>"></i></a></td>
<td><?php print $b;?></td>
<td><?php print $c;?></td>
<td><?php print $d;?></td>
<td>
<a href="reply_mail.php?key=<?php print $b; ?>"> <i class="icon-reply"></i></a>
<a href="delete_mail.php?key=<?php print $ctrl; ?>"> <i class=" icon-trash"></i></a>
</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
包括“sql.php”;
$SQL=“选择*从消息传递到收件人的位置=“$user”按日期订购\u发送说明”;
$result=mysql\u查询($SQL);
而($db\u field=mysql\u fetch\u assoc($result)){
$ctrl=$db_字段['ctrl_no'];
$a=$db_字段[‘打开’];
$b=$db_字段['from_sender'];
$c=$db_字段['mail_subject'];
$d=$db_字段['date_send'];
?>
×
阅读邮件
$SQL=“更新消息集已打开=1,其中ctrl\u no='$ctrl';
mysql_查询($SQL);
$SQL=“从消息中选择*,其中ctrl\u no='$ctrl';
$result=mysql\u查询($SQL);
如果($db\u field=mysql\u fetch\u assoc($result)){
$a=$db_字段[‘打开’];
$b=$db_字段['from_sender'];
$c=$db_字段['mail_subject'];
$d=$db_字段['date_send'];
}
?>表格:
日期:
附属的:
味精
<!-- Read inbox Messages -->
$SQL = "UPDATE messaging SET opened = 1 WHERE ctrl_no = '$ctrl'";
mysql_query($SQL);
$SQL = "SELECT * FROM messaging WHERE ctrl_no = '$ctrl'";
$result = mysql_query($SQL);
if( $db_field = mysql_fetch_assoc($result)){
$a = $db_field['opened'];
$b = $db_field['from_sender'];
$c = $db_field['mail_subject'];
$d = $db_field['date_send'];
}
?> <h2>Form:<?php print $b ?></h2>
<p>Date:<?php print $d; ?></p>
<h4>Sub:<?php print $c; ?></h4>
<p>Msg<?php print $mess; ?></p>
</div>