php error Catchable fatal error when making query

1

I have this doubt, it is probably very simple answer but I have very little doing this because I still do not soak up the logic hehehehe. Good to the question:

This part of the code marks me the error: "Catchable fatal error: Object of class mysqli_result could not be converted to string"

 $queryjoin="SELECT matriculas.matricula from matriculas inner join aspirantes on matriculas.id_mat=aspirantes.id_asp where aspirantes.folio=$id;";
                     $n_control = mysqli_query($link,$queryjoin); echo $n_control; 

can you help me? they are two tables in a same base, when I run it in the consulate of mysql if it gives me the desired result but here when doing the echo $ n_control; Mark me that error, help for fa in the tables the values are INT

A thousand thanks

    
asked by Erick Castillo 06.06.2018 в 21:03
source

1 answer

0

The variable $ n_control contains an object of type mysqli_result. You can only use echo to display strings. The usual way is done:

$queryjoin="SELECT matriculas.matricula from matriculas inner join aspirantes on matriculas.id_mat=aspirantes.id_asp where aspirantes.folio=$id;";
$n_control = mysqli_query($link,$queryjoin);

while($row = mysqli_fetch_assoc($n_control)) {
    echo $row['matricula'];
}
    
answered by 06.06.2018 / 21:10
source