ユーザーのリストをオンラインで表示しようとしています。そして、私はSQLを持っていますが、私のページには「SQL構文にエラーがあります。使用する正しい構文については、MySQLサーバーのバージョンに対応するマニュアルを確認してください」近くで「8行目」、どうすればいいのか疑問に思っていましたエラーなしでユーザーのリストを表示します。
<?php $sql = "SELECT
user_id,
user_name,
online
FROM
users
WHERE
user_id = " . mysql_real_escape_string($_GET['id']);
$result = mysql_query($sql);
if(!$result)
{
echo 'There are currently no user online.' . mysql_error();
}
else
{
if(mysql_num_rows($result) == 0)
{
echo 'There are currently no user online.';
}
else
{
//display category data
while($row = mysql_fetch_assoc($result))
{ $D= $row['online'];
if( ($D) !=1)
{
echo 'There are currently no user online.';
}
else
{
echo'<a href="/index.php?area=profile&userid=' . $posts_row['user_id'] . '" class="topicuser_member"><span ' . $posts_row['user_class'] . '>' . $posts_row['user_name'] . '</span></a>,';}}}}?>