How do I display the search results in the database?

Asked

Viewed 41 times

-1

I have the following line in the code on my page variaveis.php

$selficha = mysqli_query($conexao,"SELECT deus FROM ficha WHERE nome='$user->username'");

$ficha = mysqli_fetch_row($selficha);

I put her on the page ficha.php, but when I give print $ficha to show the result, appears Array instead of the die.

  • 2

    You have studied array of PHP?

  • And Raphael, quiet on the River ?! I think this link can help you https://answall.com/questions/3567/howto display-o-resultado-de-uma-query-numa-p%C3%A1gina-html-em-php Good luck !

2 answers

0

I included it in the.php page, but when I print $sheet to show the result, Array appears instead of the data.

With the function mysqli_fetch_row(), you will have a return in vector/list form (non-associative). So, you should display your value like this:

print($ficha[0]);
//print($ficha[1]);
// ...

Reference: PHP - mysqli_fetch_row;

Recommended reading: PHP - Arrays

0

It worked out! I was looking like this before all this: $selficha = mysqli_query($connection,"SELECT * FROM sheet where name='$user->username'");

$fiche = mysqli_fetch_row($selficha);

And then on the print $ficha[deus] nothing was showing up

Browser other questions tagged

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