1

I want to print

<?php echo isset($meta['category_id']) ? $meta['category_id'] : '' ; ?>

This code is here in place number 2

`<?php   
$sql = "SELECT title FROM posts WHERE category_id = '2'";
$result = $conn->query($sql);

if ($result->num_rows > 0) {
    // output data of each row
    while($row = $result->fetch_assoc()) {
        echo $row["title"]. "<br>";
    }
} else {
    echo "0 results";
}
?>`

This is a screenshot, with the knowledge that "category_id" will call the number of the group to which the post belongs.

enter image description here

Dharman
  • 30,962
  • 25
  • 85
  • 135

1 Answers1

0

Thank you all the solution was

$ sql = "SELECT title FROM posts WHERE category_id =". $ meta ['category_id'];