Difficulty with mysqli_fetch_object

Asked

Viewed 43 times

0

I’m performing the function as follows:

Through a query:

<?php
[...]
$sql = 
"SELECT f_u.*, f_i.*, f_g.* FROM form_user AS f_u 
LEFT JOIN form_imovel AS f_i ON f_i.imovel_id = $imovel_id 
LEFT JOIN form_img AS f_g ON f_g.imovel_id = $imovel_id WHERE f_u.user_id = 
$user_id"; 
$result = mysqli_query($con,$sql);
$row_cont = mysqli_num_rows($result);
echo $row_cont;
while($rowb = mysqli_fetch_object($result))
{    echo '$rowb->file_name';
} 
?>

But on the way out I get the line count($row_cont=3), but the result of while returns only 2 results.

Edit This query is made in 3 tables where form_user and form_imovel I have only 1 record and form_img table 3 with the same id of imovel_id.

form_user  | form_imovel       | form_img
----------   ------------------  -----------------------
user_id      user_id| imovel_id  imovel_id|file_name
77           77       7          7         seven.jpg
                                 7         seven7.jpg
                                 7         seven77.jpg
  • Do a test using the mysqli_fetch_all(), to check if all items come.

  • 2

    found out where the bug is I’ll edit the question...

  • If you managed to solve the problem put the answer, and then define it as correct.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.