I have the following code I'm learning:
$mysqli = new mysqli('localhost', 'root', '', 'mydb');
$sql = "SELECT * FROM ordem_producao WHERE op_id = $id;";
$query = $mysqli->query($sql);
$resultado = $query->fetch_assoc($sql);
no body
of my html I have:
<?php echo $resultado['id']; ?>
The following error message appears on the page
PHP Warning: mysqli_result :: fetch_assoc () expects exactly 0 parameters, 1 given in E: \ home \ pages \ view \ view_op.php on line 9
line 9 is the code
$resultado = $query->fetch_assoc($sql);
What am I doing wrong?
Thank you