tags:

views:

64

answers:

3

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'

+2  A: 

You're telling us yourself - the key column in pages is pages.page_id, not pages.page which you're using in your join.

Björn
+1  A: 

Try replacing pages.page with pages.page_id

Todd R
+3  A: 

Try changing it to:

INNER JOIN pages    ON updates.page  = pages.page_id
Jamie Ide
hey, that seemed to do the trick..thank you for your help!Ryan
Coughlin