I need to develop a code where the row total of a SELECT is stored in a variable. I wrote the code below, but when I use WHERE it returns a "Notice: Trying to get property of non-object in" error.
Is it possible to do a SELECT using a WHERE and save the total of records located in a variable with the format "0000"?
include "conecta_mysql.inc";
$escritorio = $_POST["n_escritorio"];
$resultado = $mysqli->query("SELECT * FROM registros WHERE escritorio=$escritorio");
$linhas = $resultado->num_rows;
$mysqli->close();