$pdo = new PDO("mysql:host=localhost;dbname=...;","db_user","password");
$statement = $pdo->prepare(
"SELECT * FROM posts p JOIN posts_category pc ON pc.category_id = p.posts_category_id
WHERE pc.category_alias = ?"
);
$statement->bindValue(1, $name, \PDO::PARAM_STR);
$statement->execute();
$result = $statement->fetchAll(\PDO::FETCH_ASSOC);