<tr id="campo-select">
<td>
<strong>Personas:</strong>
</td>
<td>
<?php $consulta_listar_usuario = $usuario->listUserpordepartamento($conexion); ?>
<span id="error-persona">
<select class="browser-default" name="persona0" id="persona0" required>
<option value="0">-</option>
<?php while($resultado_listar_usuario = $consulta_listar_usuario->fetch_array(MYSQLI_ASSOC)): ?>
<option value="<?php echo $resultado_listar_usuario['idUsuario'];?>"><?php echo $resultado_listar_usuario['personaNombre'];?> <?php echo $resultado_listar_usuario['apellido'];?> <?php echo $resultado_listar_usuario['email'];?> <?php echo $resultado_listar_usuario['nombreDepartamento'];?></option>
<?php endwhile; ?>
</select>
</span>
<td><button type="button" class="btn" id="suma_persona" ><i class="fa fa-plus" aria-hidden="true"></i></button></td>
<td><button type="button" class="btn" id="borra_persona" ><i class="fa fa-minus" aria-hidden="true"></i></button></td>
<input type="hidden" name="cantidad_persona" id="cantidad_persona">
</td>
</tr>
I have an element in a table which brings me with an sql query the values of registered users.
I'm trying to make a filter that only brings me the fields that contain a specific id, like the one used by the user entered
function listUserpordepartamento($conexion){
$consulta = (mysqli_query($conexion, "SELECT *, p.nombre as personaNombre, p.id as idPersona, d.nombre as nombreDepartamento, u.id as idUsuario, u.nombre as nombreUsuario
FROM persona as p
JOIN usuario as u
on p.id = u.id_persona
JOIN departamento as d
on u.id_departamento = d.id
ORDER BY p.nombre ASC")) or die("Error listando Usuarios: ".mysqli_error($conexion));
return $consulta;
}
I have errors in bringing the fields, I declare the variable privately
private $departamento;
and the department
function setDepartamento($departamento){
$this->departamento = $departamento;
}
I hope you understand, I already get involved. thanks for the help