I have a issue with a SELECT query. I'm basically trying to get information from two different tables, I want the customer information (orders) + the customers products (orders_products) and I only want the information for that specific ID.
Both tables have the user_id
column.
$conn = new PDO('mysql:host='. DB_HOST .';dbname='. DB_NAME . ';charset=utf8', DB_USER, DB_PASS);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$sth = $conn->prepare("SELECT * FROM orders, orders_products WHERE `orders.user_id` = `orders_products.user_id` = :user_id");
$sth->bindValue(':user_id', $_GET['id']);
$sth->execute();
$result = $sth->fetch();