Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP Integrating PHP with Databases Using Relational Tables Querying Multiple Tables with JOIN

Steve Berrill
Steve Berrill
20,016 Points

sql error when running this locally

When i run this locally i get this error

Connection failed: SQLSTATE[23000]: Integrity constraint violation: 1052 Column 'media_id' in field list is ambiguous

1 Answer

Andres Aguero
Andres Aguero
30,545 Points

Hi Steve,

I was having trouble with this on Workspaces as well. I was getting the same error "Column 'media_id' in field list is ambiguous". After searching for answers I found the problem.

Instead of selecting SELECT media_id you need to SELECT Media.media_id.

Steve Berrill
Steve Berrill
20,016 Points

thanks for replying. been a while since that and i fixed it but cant remember what i did lol