S
S
sunnyrio2018-06-21 15:02:23
MySQL
sunnyrio, 2018-06-21 15:02:23

What to fix to make a query for a selection from two tables work?

Why is the request not working?

$query = "SELECT products.name AS product, users.name AS user, orders.count AS qty FROM orders LEFT JOIN users ON orders.user_id = users.id LEFT JOIN products ON orders.product_id = products.id WHERE id = $ord_id";

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sunnyrio, 2018-06-21
@sunnyrio

Since several tables are used for the id parameter, you need to specify the table, orders.id instead of id

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question