Php 票证系统-当用户没有任何票证时显示消息

Php 票证系统-当用户没有任何票证时显示消息,php,ticket-system,Php,Ticket System,我正在开发一个新的售票系统,但出了点问题。当用户没有打开的票证时,应显示以下消息: <?}else{?> <tr> <td style="background:#f7f7f7;">There are no tickets submitted yet.</td> </tr> <?}?> 还没有提交门票。 我可能做错了什么,我不知道在哪里。这是我的代码: <?php if($_GET['a']

我正在开发一个新的售票系统,但出了点问题。当用户没有打开的票证时,应显示以下消息:

 <?}else{?>
<tr>
     <td style="background:#f7f7f7;">There are no tickets submitted yet.</td>
     </tr>
<?}?>

还没有提交门票。
我可能做错了什么,我不知道在哪里。这是我的代码:

<?php 
if($_GET['a'] == "del" && $_GET['id'] != ""){
mysql_query("DELETE FROM message WHERE id='{$_GET['id']}' LIMIT 1;");
}

$msg = mysql_query("SELECT * FROM `message` WHERE `receiver`='{$_SESSION['login']}' ORDER BY date DESC")or die (mysql_error());
?>
<table id="nested" width="97%" cellspacing=0 cellpadding=0 style="border-collapse:collapse;">
<tr><th width="50px">ID</th><th width="110px">Date</th><th width="165px">Title</th><th width="90px">Status</th><th align="right" width="60px">Actions</th></tr></div>
<tbody>
<?php 
while($mesg = mysql_fetch_array($msg)) {
?>
<tr class="">
<th><?php echo $mesg['id']; ?> </th>
<td><?php echo $mesg['date']; ?> </td>
<td><?php echo $mesg['title']; ?> </td>

<td><?php
if($mesg['readed']) { echo "Read";
}else{ echo "Unread";
} ?> </td>
<th><ul class="action-buttons">


<li><a href="#myTickets?id=<?=$mesg['id']?>" class="action-button" title="Read"><span class="read"></span></a></li>
                <li><a href="#myTickets?a=del&id=<?=$mesg['id']?>" class="action-button" title="Delete"><span class="delete"></span></a></li>
                <li><a href="#myTickets?a=close&id=<?=$mesg['id']?>" class="action-button" title="Close"><span class="close"></span></a></li></ul>

<? } ?>

 </th>

<?}else{?>
    <tr>
         <td style="background:#f7f7f7;">There are no tickets submitted yet.</td>
         </tr>
    <?}?>

</tr>

</tbody>
</table>
</table>

请检查大括号。这是不平衡的

<?php 
     if( mysql_num_rows($msg) == 0 ) { ?>    //means the query returns empty set.
        <tr>
             <td style="background:#f7f7f7;"> //There are no tickets submitted yet.</td>
        </tr>
<?php } else {  // you have messages
    while($mesg = mysql_fetch_array($msg)) {
         // finish ur while loop
 ?>
//表示查询返回空集。
//还没有提交门票。

没有与
else
匹配的
if
语句。在有票证时添加一个
if
,或者在没有票证时将
else
更改为
if
,其计算结果为
true

例如:

<?if ( mysql_num_rows($msg) == 0 ) {?>
    <tr>
        <td style="background:#f7f7f7;">There are no tickets submitted yet.</td>
    </tr>
<?}?>

还没有提交门票。

对不起,我是php新手,我不明白你的意思。。。你可以做些什么,比如在哪里改变?希望这能为你指明正确的方向。但是您需要阅读
if
语句中的php文档。不客气。如果有帮助,请回答这个问题。