I am trying to retrieve data from a table in the database based off of a persons user id. I keep getting:
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /xampp/... on line 50
and,
Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /xampp/... on line 52
Here is my code:
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. }
I also put or die(mysql_error()); on all my sql queries and I keep getting:
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
Line 1 on my page is:
<?php include_once('config.php'); ?> //Connect to database
So that doesn't make any sense. Please help me.
Thanks