sql query returning false

Asked

Viewed 33 times

-2

I have a digital catalog that works normally on my local server, but when I go up to my hostgator hosting it returns me the following error:

PHP Warning:  mysqli_fetch_assoc() expects parameter 1 to be mysqli_result, bool given in

error happens on this line:

while($rows_produtos = mysqli_fetch_assoc($resultado_produtos)){ ?>

data from my sql query:

$result_produtos = "SELECT * FROM produtos where estoque >= 1";

$resultado_produtos = mysqli_query($conn, $result_produtos);

Note: I have checked everything and do not know what I am doing wrong.

  • what I don’t understand is that the system works perfectly on the localhost server, only when I go up it shows this error.

  • I managed to solve my problem, it was an information error that was preventing the connection as database, I just made change $dbname to $bank and it worked! thank you for your attention.

1 answer

1

Apparently your query is returning some error (probably from syntax).

I recommend you add the following code below this line:

$resultado_produtos = mysqli_query($conn, $result_produtos);
if(!$resultado_produtos) {
    die(mysqli_error());
}

Consider also taking a look at documentation.

  • did this plus the error has now gone to another line, follows the error line: die(mysqli_error());

Browser other questions tagged

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