Hello, friends.
I have 3 tables in my mysqli database to register access to a given location:
visitor, whose data will always be filled.
corporate, whose data will be populated only if the visitor represents a company.
Vehicle, whose data will be filled if the visitor comes by car.
When doing a search to return all the results, I use the following query:
SELECT *
FROM 'visitante'
LEFT JOIN 'corporativo' ON 'corporativo'.'id_visitante' = 'visitante'.'id_visitante'
LEFT JOIN 'veiculo' ON 'veiculo'.'id_visitante' = 'visitante'.'id_visitante'
WHERE 'visitante'.'entrada' LIKE '%$data%' OR 'visitante'.'status' LIKE '%Aberto%'
GROUP BY 'visitante'.'id_visitante'
ORDER BY 'visitante'.'entrada';
What happens is that in records where I do not have corporate visitor data or vehicle data, it returns my viewer id as NULL.
I think it's a PHP problem because when you do this query in phpmyadmin, it returns all the data normally.
Does anyone have any suggestions?
Thank you.