0
I made a query to select all user records of a table, but I inserted a filter where the admin selects the state and filters only the user records of the selected UF, but is giving error in return.
<?php
if( !isset( $_GET['uf'] ) ) {
## Assim funciona corretamente, retorna todos registros de todos usuários
$sql = "SELECT r.* FROM `registros` FROM `registros` r WHERE r.`registro` = 'A' ORDER BY r.`registros_data_cad` DESC";
} else if ( isset( $_GET['uf'] ) ) {
## Assim seleciona apenas registros de um UF, ex: AC
$where_clause = "AND ( SELECT u.`user_uf` FROM `user` u WHERE u.`user_uf` = '" . mysqli_real_escape_string( $mysqli, $_REQUEST['uf'] ) . "' )";
$sql = "SELECT r.* FROM `registros` FROM `registros` r " WHERE r.`registro` = 'A' " . $where_clause . " ORDER BY r.`registros_data_cad` DESC";
}
?>
I tried that way but it’s a mistake, could give me a help here?
Warning: mysqli_num_rows() expects Parameter 1 to be mysqli_result, Boolean Given in /home/atc2018/public_html/balance.php on line 106;
Pasting in phpmyadmin gives error #1054, I consulted and is nonexistent column, however the column exists.
What would be the mistake? Failed to report this only :)
– Matheus Ribeiro