1

我正在尝试为我的网站编写一个基本的消息传递系统。我已经设置了发送和接收,但由于某种原因,在收件箱中,html 只是停止显示。它显示在页面的一半,然后由于某种原因停止。如果我输入,甚至不会显示基本的 html

你好

它不会出现。我很困惑,因为这从来没有发生过。

        </table> 
<p>Hello</p><!--THIS WILL DISPLAY-->
<?php
///////////End take away///////////////////////
// SQL to gather their entire PM list
include_once ('../../mysql_server/connect_to_mysql.php');
$sql = mysql_query("SELECT * FROM messaging WHERE to_id='$my_id' AND    recipientDelete='0' ORDER BY id DESC LIMIT 100");

while($row = mysql_fetch_array($sql)){ 

$date = strftime("%b %d, %Y",strtotime($row['time_sent']));
if($row['opened'] == "0"){
        $textWeight = 'msgDefault';
} else {
        $textWeight = 'msgRead';
}
$fr_id = $row['from_id'];    
// SQL - Collect username for sender inside loop
$ret = mysql_query("SELECT * FROM myMembers WHERE id='$fr_id' LIMIT 1");
while($raw = mysql_fetch_array($ret)){ $Sid = $raw['id']; $Sname = $raw['firstname']; }

?> 
<p>Hello</p><!--THIS WON'T DISPLAY-->
    <table width="96%" border="0" align="center" cellpadding="4">

任何帮助表示赞赏..

编辑:

第一个 while 循环确实关闭,就在表格之后。第一个 while 循环之外的所有内容都会显示,但是,while 循环内的所有内容都不会显示。

4

1 回答 1

1

不知道这是否只是一个剪切和粘贴错误,但您的第一个 while 循环看起来并没有关闭。尝试关闭它,看看它从那里去哪里。

while($row = mysql_fetch_array($sql)){ //needs closing

编辑:您是否尝试过查看您的 sql 是否抛出任何错误:

// Check result
// This shows the actual query sent to MySQL, and the error. Useful for debugging.
if (!$sql) {
    $message  = 'Invalid query: ' . mysql_error() . "\n";
    $message .= 'Whole query: ' . $query;
    die($message);
}

这个 PHP链接可能很有用。

于 2012-05-18T22:32:43.483 回答