1
Hello, I have created a search field, and I need to return the results of tb_orders based on the client’s name. However, only the client’s id is saved in this table, and the search is done by name. The client’s data is in the tb_clients. I looked for some information on the forums, but I couldn’t resolve.
$get_ordens = $pdo->prepare('SELECT a.*, b.nome FROM tb_ordens as a LEFT JOIN tb_clientes as b on a.cliente = b.nome WHERE fechada = 0 AND (cliente LIKE :busca) ORDER BY data');
$get_ordens->execute(array(
':busca' => '%'.$busca.'%'
));
Cool, it worked. Thanks, Andre!
– Emerson Matheus