I have this function that brings me the tickets associated with a user_department of the user that enters the system
function listTicketUnrevisedSupervisor($conexion, $id){
$consulta = mysqli_query($conexion, "SELECT *,
t.id as id_ticket, u.id as user_id,
t.fecha_creacion as t_fcreacion,
t.hora_creacion as t_hcreacion
FROM ticket as t
JOIN usuario AS u ON t.id_usuario = u.id
WHERE t.status <> '3'
AND u.id_departamento = ".$id."
ORDER BY t.id DESC ")
or die("Error listando Ticket: ".mysqli_error($conexion));
return $consulta;
}
I'm trying to do the count of the list but I have errors
function contarlistTicketUnrevisedSupervisor($conexion, $id){
$consulta = mysqli_query($conexion, "SELECT *,
COUNT(t.id) as id_ticket, u.id as user_id,
t.fecha_creacion as t_fcreacion,
t.hora_creacion as t_hcreacion
FROM ticket as t
JOIN usuario AS u ON t.id_usuario = u.id
WHERE t.status <> '3'
AND u.id_departamento = ".$id."")
or die("Error listando Ticket: ".mysqli_error($conexion));
return $consulta;
}
"you have an error in your sql syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near * at line 5"
The two parameters & connection and the $ id have already been declared, including the apartment_id whose value I assign it to when entering and bring it to me, what am I doing wrong?