I made a code to send on the screen the number of Cpf, It is working but acknowledging an error!

Asked

Viewed 34 times

0

<?php   
        include"conectar.php";

$query="select cpf from teste where cpf = '" . $cpf . "' order by teste";
$stmt=mysqli_query($con,$query);
if($stmt) {

     $today = date("d.m.y");
} else {
     mysqli_rollback($con);
     echo "Transaction rolled back.<br />";
}


while($row=mysqli_fetch_array($stmt) )
{   
                  $cpf = $row['cpf'];

}


mysqli_close($con);          
        ?>

the error is as follows....

Transaction rolled back.

Warning: mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given 

Remembering the result is ok! But accuses this error! Thank you!

  • You read the warning message?

  • I don’t understand Jefferson, it might be a little clearer?

  • Yes, I can: you saw what you have after "Warning: " until the end of the line?

  • Warning: mysqli_fetch_array() expects Parameter 1 to be mysqli_result, Boolean Given in......while($Row=mysqli_fetch_array($stmt) ) ː $name = $Row['name']; }

  • And that warning means what?

  • 2

    Tip: You seem to be sorting by table name instead of sorting by column name.

  • Thanks Anderson solved the problem!

  • I am voting to close this question as out of scope because the problem has been solved without answers.

Show 3 more comments
No answers

Browser other questions tagged

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