i have 3 tables called company, customers,and comments.first i add company then the customers are added in customers table and finaly the customers add comments in comments table.
Here is the structure of company table:
id company type address
1 abc running xyz
2 def old asd
Here is the structure of customers table:
cid company customername location
1 1 test delhi
2 2 test1 noida
Here is the structure of comments table:
id company customer comments
1 1 test testcomments
2 2 test1 test1comments
now i want to search in cutomers table by customers name, company name and location so i have tried this but unable to get the value of comments on search how can i achieve it.
here is my search query for companyname and location:
$sql = mysql_query("Select * from customers AS cust INNER JOIN company AS comp ON cust.company = comp.id where cust.name like '%$term%' or cust.location like '%$term%' or comp.company like '%$term%'");