Fetch integer value in BD

Asked

Viewed 32 times

0

Good afternoon, I’m trying to query an entire value in my BD and save it in a variable, I tried this way:

$procuraPreco = mysqli_query($connect, "SELECT preco FROM infs WHERE seis='$seis' and bin='$bin' and quantidade='$qndtd'");
print_r($retornaPreco = mysqli_fetch_all($procuraPreco,MYSQLI_ASSOC));

The array is returning empty. I know it might be a possible duplicate but I’ve tried a lot of ways and I couldn’t

  • Printa sua sql, to see if the variables are filled in correctly. Pq the name of this variable $qndtd is a little strange, sometimes it was meant to be $qntd and you made a mistake

  • Printa the query and test to see if you have feedback from it, if possible add the sql structure and the echo of the query so we can test.

  • I got it. It was a variable error anyway, thank you.

1 answer

-1

I think it might be your query using php variables. It would look like this:

$procuraPreco = mysqli_query($connect, "SELECT preco FROM infs WHERE seis='".$six."' and bin='".$bin."' and quantity='".$qndtd."';"); print_r($retornaPreco = mysqli_fetch_all($procuraPreco,MYSQLI_ASSOC));

Browser other questions tagged

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