lawrence_dev
asked on
Transitioning to PDO/MySQL. Need help with SELECT statement with LEFT JOIN
I need assistance with a left join on a a SELECT statement. I am not getting any errors, however, I am not getting any results either...
$conn = new PDO("mysql:host=$host;dbname=$db;charset=$charset", $user, $pass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
// Establish a MySQL connection
$query2 = $conn->prepare('SELECT * FROM `product`
LEFT JOIN `product_description`
USING (product_id)
LEFT JOIN url_alias
USING (query)');
while ($row2 = $query2->fetch(PDO::FETCH_ASSOC))
{
echo $row2['product_id']." ".$row2['description']." ".$row2['query'];
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks!
Hard to debug without knowing the tables, but it looks OK.