Hi I'm trying to get the values of a table that references 2 tables. my tables looks like this
pages_content table
page_id | content_id
------------------------
1 | 4
6 | 10
pages table
id | title
-----------------
1 | home
6 | contact
content table
id | content
-----------------
4 | home page
10 | contact us
I need to reference the pages_content table and get the values that are in the other tables.
I tried this
$content = DB::select('select * from pages_content pxc, content c where page_id = '.$page_id.' and content_id = c.id');
and I got a syntax error
SQLSTATE[42000]: Syntax error or access violation: 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 '<p>home page</p> and content_id = c.id' at line 1 (SQL: select * from pages_content pxc, content c where page_id = <p>home page</p> and content_id = c.id) (View: /Applications/MAMP/htdocs/test/app/views/public/content.blade.php)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community