I have a join using mysql in php and want to turn that into a pdo query how do i do that?
Also how do I get the results of this query and display it.
Code is below:
$query = "SELECT * FROM pages LEFT JOIN templates ON pages.template_id = templates.template_id WHERE pages.page_Title = '".$getVars['page']."'";
I am new to PDO so this might sound like a very basic question.
Thanks in Advance
Why don’t people even look at the PHP reference for these basic questions? See https://www.php.net/manual/en/pdo.connections.php. It’s all there, you don’t have to change anything to the query in order to run it with PDO.
You could however try using a prepared statement, and pass the title as a parameter :