0

Whats wrong with this query

$yourfriendsbud = mysqli_query($con, "SELECT avatar,firstname,lastname,id
FROM people 
INNER JOIN friends
ON 
people.id=friends.zatrazio_id
WHERE status=0 AND dobio_id='$user_id' LIMIT 50");
while($row = mysqli_fetch_array($yourfriendsbud))

It reports the error:

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in /home/u573639388/public_html/menu.php on line 64

line 64 is

while($row = mysqli_fetch_array($yourfriendsbud))
Michael Berkowski
  • 267,341
  • 46
  • 444
  • 390
Champa
  • 9
  • 1
  • You have to check for errors. `if (!$yourfriendsbud) echo mysqli_error($con);` – Michael Berkowski Jan 20 '15 at 13:58
  • Show some more code please. Connection to db ... You should use prepared statement. – Jens Jan 20 '15 at 14:01
  • It says Column 'id' in field list is ambiguous – Champa Jan 20 '15 at 14:01
  • That means you have an `id` column in both tables. You have to be more specific in the `SELECT`, using `SELECT people.id, avatar, firstname...` – Michael Berkowski Jan 20 '15 at 14:03
  • possible duplicate of [mysql\_fetch\_array() expects parameter 1 to be resource (or mysqli\_result), boolean given](http://stackoverflow.com/questions/2973202/mysql-fetch-array-expects-parameter-1-to-be-resource-or-mysqli-result-boole) – RandomSeed Jan 20 '15 at 14:27

1 Answers1

0

That means you have an id column in both tables. You have to be more specific in the SELECT, using SELECT people.id, avatar, firstname...

Champa
  • 9
  • 1