Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/284.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 我的mysql语法有一个错误_Php_Mysql_Sql_Syntax Error - Fatal编程技术网

Php 我的mysql语法有一个错误

Php 我的mysql语法有一个错误,php,mysql,sql,syntax-error,Php,Mysql,Sql,Syntax Error,我试图根据persons用户id从数据库中的表中检索数据。 我不断得到: Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /xampp/... on line 50 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the

我试图根据persons用户id从数据库中的表中检索数据。 我不断得到:

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /xampp/... on line 50
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'bla bla bla' at line 1
以及

这是我的密码:

37.    $sql6 = mysql_query("SELECT * FROM replies WHERE thread_id = $thread_id");
38.    $numRows = mysql_num_rows($sql6);
39.    $replies = '';
40.    if ($numRows < 1) {
41.        $replies =  "There are no replies yet, you can make the first!";
42.    } else {
43.       while ($rows = mysql_fetch_array($sql6)) {
44.            $reply_content = $rows[5];
45.            $reply_username = $rows[7];
46.            $reply_date = $rows[8];
47.            $reply_author_id = $rows[4];
48.            
49.            $sql9 = mysql_query("SELECT * FROM users WHERE id = $reply_author_id");
50.            $numRows = mysql_num_rows($sql9); 
51.            if ($numRows < 1) {
52.                while ($rows = mysql_fetch_array($sql9)) {
53.                    $reply_user_fn = $rows['first_name'];
54.                    $reply_user_ln = $rows['last_name'];
55.                    $reply_user_id = $rows['id'];
56.                    $reply_user_pp = $rows['profile_pic'];
57.                    $reply_user_lvl = $rows['user_level'];
58.                    $reply_user_threads = $rows['threads'];
59.                    $reply_user_email = $rows['email'];
60.                        
61.                        
62.                    }
63.                }
64.            }
65.        }
我的页面上的第1行是:

<?php include_once('config.php'); ?> //Connect to database
//连接到数据库
所以这没有任何意义。请帮帮我

谢谢

尝试交换此(添加“”):


我建议,尝试连接查询。试试这个

$sql9 = mysql_query("SELECT * FROM users WHERE id = ".$reply_author_id);

我总是使用这种格式。我希望这能对你有所帮助。

发生这种情况时$reply\u author\u id的值是多少?你到底为什么不加入你的表,例如
SELECT*FROM repries LEFT join users.id=repries.author\u id WHERE repries.thread\u id=?
字符串
'bla bla bla bla'
来自哪里?
$sql9 = mysql_query("SELECT * FROM users WHERE id = '$reply_author_id'");
$sql9 = mysql_query("SELECT * FROM users WHERE id = ".$reply_author_id);