I'm having an odd problem. The query below is pulling from two tables. The table "category" has 11 records. When PHP displays the record in a loop, it will display "project_name" 11 times for each project. If I add another "category" record, it will display "project_name" 12 times. I only need / want each record to display once. Any help would be appreciated.
SELECT project_id,project_name,category_full FROM project,category WHERE project_cat LIKE'%$cat%' ORDER BY project_name ASC
You are asking for a JOIN between two tables, project and category, without specifying what the conditions for the join are. Either use LEFT JOIN ... ON ... syntax or set the criteria in the WHERE clause.
You have not use any of the joing between both table therefore it's showing that records Use below query
SELECT P.project_id,P.project_name,C.category_full FROM project P,category C WHERE P.project_cat LIKE'%$cat%' AND P.categoryID=C.categoryID ORDER BY project_name
ASC
C.CategoryID will be the CategoryID in Category Table and P.CategoryID will be the categoryID used in project table