当我将此代码添加到我的 PHP 文件时
include "sql_connect.php";
$query_blog="SELECT * FROM messages";
$result_blog=mysql_query($query_blog);
$num_blog=mysql_numrows($result_blog);
mysql_close();
$sql_index_menu="0";
while ($sql_index_menu < $num) {
$msg_subject=mysql_result($result,$sql_index_menu,"subject");
$msg_id=mysql_result($result,$sql_index_menu,"id");
$msg_from=mysql_result($result,$sql_index_menu,"from");
$msg_to=mysql_result($result,$sql_index_menu,"recipient");
$msg_text=mysql_result($result,$sql_index_menu,"text");
$msg_time=mysql_result($result,$sql_index_menu,"time");
$msg_read=mysql_result($result,$sql_index_menu,"readed");
?>
<tr>
<td><a href="?action=view&id=<?php echo $msg_id; ?>&lang=<?php echo $actLang; ?>"><?php if($msg_read == "0") {echo "<img src='/images/message.gif' width='32' height='32'>";} else {echo "<img src='/images/message.png' width='32' height='32'>";}?> <?php echo $msg_time; ?></a></td><td><a href="?action=view&id=<?php echo $msg_id; ?>&lang=<?php echo $actLang; ?>"><?php echo $msg_subject; ?></a></td><td><a href="?action=view&id=<?php echo $msg_id; ?>&lang=<?php echo $actLang; ?>"><?php echo $msg_from; ?></a></td>
</tr>
<?php
$sql_index_menu++;
}
一切正常,但当我将其添加到 $query_blog
$query_blog="SELECT * FROM messages WHERE recipent='$username'";
所以它不会工作..
我试图用我的名字更改 $username 但它仍然无法正常工作。
这段代码有效,所以我复制了它,但仍然没有...
include "sql_connect.php";
$query="UPDATE messages
SET readed='1'
WHERE id='$id'";
$result=mysql_query($query);
$num=mysql_numrows($result);
mysql_close();
include "sql_connect.php";
$query_blog="SELECT * FROM messages WHERE id='$id'";
$result_blog=mysql_query($query_blog);
$num_blog=mysql_numrows($result_blog);
mysql_close();
$msg_text=mysql_result($result_blog,$sql_index_blog,"text");
$msg_from=mysql_result($result_blog,$sql_index_blog,"from");
$msg_subject=mysql_result($result_blog,$sql_index_blog,"subject");
$msg_time=mysql_result($result_blog,$sql_index_blog,"time");
你能帮助我吗?
我禁用了页面所需的登录,所以现在你可以看到页面(对不起语言:D)如你所见,没有错误 网站