解析错误:语法错误,意外'从'(T_STRING),期待']'

时间:2012-09-23 07:52:14

标签: sql parsing

我正在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>

1 个答案:

答案 0 :(得分:3)

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

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