0

我在 facebook 上制作一个简单的新闻提要,但我有这个错误:

解析错误:语法错误,意外的“来自”(T_STRING),在第 8 行的 C:\wamp\www\facebook\newfeed.php 中期待 ']'

我不知道出了什么问题,当我在 WAMP 中测试它时,我的查询有效。我需要帮助。

<html>
<head>
<?php
require("opendb.php");

$userid = (int) $_SESSION[`fb128_userid];
$query = mysql_query (" SELECT * FROM posts WHERE userid= ANY (
SELECT `from` as id FROM friends WHERE `to`= $userid and status='Confirmed' UNION 
SELECT `to` as id FROM friends WHERE `from`= $userid and status='Confirmed') 
ORDER BY date_created DESC LIMIT 1,10" );

require("closedb.php");
$promt = "";
while(list($id,$userid,$from,$content,$date_created) = mysql_fetch_array($query)){  
        $promt .="<hr>";
        $promt .='<p>'.substr($content,0,150)."...<a href='post.php'>see more</a></p>";
        $promt .="<a href='like.php'>    like</a> |  ";
        $promt .="<a href='comment.php?id=$id'>Comment |</a>";
        $promt .= "<p class='post-info'> | Date Created: $date_created </p> ";
        $promt .="<hr>";
    }
    ?>

</head>
<body>
<p><b>NewsFeed</b> <hr></p>
<?php echo $promt; ?>
<hr>
</body>
</html>
4

1 回答 1

3
$userid = (int) $_SESSION[`fb128_userid];

这看起来像是一个缺少的结束引号,也许你应该使用 ussign'而不是 `

于 2012-09-23T07:57:59.873 回答