A PHP Error was encountered

Severity: Notice

Message: Undefined index: project_id

Filename: models/project.php

Line Number: 39

Database Error

A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') AND p.is_live = 1 AND pd.description_id IS NOT NULL GROUP BY p.project_id ORDE' at line 20

SELECT p.short_title, p.project_id, p.title, p.date, p.overview_text, l.street, l.street_again, l.city, l.borough, l.state, i.image_path, i.image_width, i.image_height, i.image_title, i.image_caption, pd.description as description, d.document_path, GROUP_CONCAT(DISTINCT r.text ORDER BY r.text SEPARATOR '
') as role, GROUP_CONCAT(DISTINCT cl.name ORDER BY cl.name SEPARATOR '
') as clients, GROUP_CONCAT(DISTINCT a.name ORDER BY a.name SEPARATOR '
') as architects, CONCAT( 'array(', GROUP_CONCAT(DISTINCT CONCAT(' array(\'path\' => \'', i.image_path, '\',\'width\' => \'', i.image_width, '\',\'height\' => \'', i.image_height, '\',\'caption\' => \'', i.image_caption, '\',\'title\' => \'', i.image_title, '\' )') ORDER BY pdi.image_sort_order SEPARATOR ','), ')') as images FROM projects as p LEFT JOIN project_roles as pr ON pr.project_id = p.project_id LEFT JOIN roles as r ON pr.role_id = r.role_id LEFT JOIN project_architects as pa ON pa.project_id = p.project_id LEFT JOIN architects as a ON pa.architect_id = a.architect_id LEFT JOIN project_clients as pcl ON pcl.project_id = p.project_id LEFT JOIN clients as cl ON pcl.client_id = cl.client_id LEFT JOIN locations as l ON p.location_id = l.location_id LEFT JOIN project_categories as pc ON p.project_id = pc.project_id LEFT JOIN categories as c ON pc.category_id = c.category_id LEFT JOIN project_descriptions as pd ON pd.project_id = p.project_id AND pd.category_id = c.category_id LEFT JOIN project_description_images as pdi ON pd.description_id = pdi.description_id LEFT JOIN images as i ON pdi.image_id = i.image_id LEFT JOIN project_description_pdf as pdp ON pd.description_id = pdp.description_id LEFT JOIN documents as d ON pdp.document_id = d.document_id WHERE c.name LIKE 'Commercial' AND p.project_id IN (SELECT rproject_id FROM project_projects WHERE project_id = ) AND p.is_live = 1 AND pd.description_id IS NOT NULL GROUP BY p.project_id ORDER BY p.date DESC, pdi.image_sort_order ASC