简体   繁体   中英

Parse error: syntax error, unexpected 'from' (T_STRING), expecting ']'

I am making a simple newsfeed like on facebook, and I have this error:

Parse error: syntax error, unexpected 'from' (T_STRING), expecting ']' in C:\\wamp\\www\\facebook\\newfeed.php on line 8

I don't know what's wrong, my query works when I tested it in WAMP. I need help.

<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>
$userid = (int) $_SESSION[`fb128_userid];

这看起来像是缺少的结尾引号,也许您应该使用'而不是`

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM