I would like to retrieve entries in my blog_post table that have the same post category ID as the "kat_id" in the categories table to create Bread Crumbs. I would appreciate your help. I couldn't solve it with this code: $categories = $db->prepare('SELECT postkat_id FROM blog_post INNER JOIN categories ON categories.kat_id = blog_post.postkat_id WHERE postkat_id = kat_id'); $categories->execute(); if ($categories->rowCount()) { foreach ($categories as $row) { echo $row['cat_name']; } }