I'm trying to create a products based website that a user clicks through from one page which brings up a category and then splits into different applications for each product. I have have come across an initial stumbling block as I cannot get the page to display anything when trying to join my products and category tables together.
I've tried looking around for code samples to try, but as being rather new to PHP and PDO i'm struggling to understand things in simple terms.
Here's my current join which according to PMA works as it should. Any ideas how I make that statement an array I can foreach through?
if (isset($_GET['id'])) {
$id = $_GET['id'];
$data = $category->fetch_data($id);
$query = $pdo->prepare('SELECT * FROM products LEFT JOIN category on products.prod_category = category.cat_name WHERE category.cat_id=?');
$query->bindValue(1, $data);
$query->execute();
$products = $query;
}