I have this query:
$sql = "SELECT
updates.u_id AS u_id,
updates.date_submitted AS date_submitted,
updates.deadline AS deadline,
updates.description AS description,
updates.priority AS priority,
pages.page_name AS page_name,
clients.fname AS fname,
clients.lname AS lname,
projects.p_url AS p_url,
projects.p_title AS p_title
FROM updates
INNER JOIN projects ON updates.p_id = projects.p_id
INNER JOIN clients ON projects.c_id = clients.c_id
INNER JOIN pages ON updates.page = pages.page
LEFT JOIN admin ON updates.a_id = admin.a_id
WHERE u_id='$id' LIMIT 1";
And the part that is giving me an issue is:
INNER JOIN pages ON updates.page = pages.page
I am using this query to display update information on a certain project. I have the pages stored in the table PAGES and when a client submits an update, they can pick which page they want the update on.
I have this in my UPDATE table: updates.page which is stored as INT in this case for one of my rows is "1"
In my PAGES table I have: pages.page_id which is the same as: updates.page
Any idea what i can do with my query to fix that?
ERROR:
Unknown column 'pages.page' in 'on clause'