2012-05-18 121 views
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循环内的所有内容都不显示。

+1

您的PHP可能在某处存在错误,是否有任何错误(它们是否已启用?) – Hidde

回答

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 link可能是有用的。