0
I need to develop a code where the line total of a SELECT is stored in a variable. I wrote the code below, but when I use WHERE returns an error "Notice: Trying to get Property of non-object in".
It is possible to make a SELECT using a WHERE and save the total number 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();
The returned result is integer. If you want to format the result, check how many houses this number has and complete with zeros left to form 4 digits.
– Jefferson Quesado
Jefferson, good afternoon! In this case I must use a switch case to check the number of digits and complete concatenating with 0?
– Renato