Hi,
I'm making a small web-based software and I need help for a search query that looks for results in 2 tables.
I can run it very well like this for a single table :
$query=mysql_query("SELECT * FROM `customers` WHERE `name` LIKE \"%$search%\" ORDER BY `name` ASC");
But, here is the tricky part. I have 2 tables :
Table 1 (customers) :
client_id : 8
name : Johnny Depp
address : bla bla bla
etc...
Table 2 (animals) :
animal_id : 52
client_id : 8 (it refers to the client)
Name : Rex
etc....
So, Johnny Depp has a Dog named Rex. I have a search field, if I type "Johnny Depp", or "Depp", it will give me "Johnny Depp (client_id:8)" as the result, but I want to be also able to get the same result with the name of his dog. If I type "Rex", the result will be "Johnny Depp (client_id:8)", because in table 2, there is a dog named Rex with the client_id 8.
How can I do that? Thank you very much for your help !