I have a table in my database and It has 4 columns, In these columns, a column, named "Post_status". This column has two types of values one is "Published" and the other one is "Draft". I wanna that If all values are equal to "Draft" then echo 'No Post found' and If even one value is equal to "Published" then echo 'Post Found'. I have tried lots of time with if statement but I couldn't... Because mysqli_query gives me all the values together like this "DraftPublishedPublishedDraft..."
How can I check each value of the column?
<?php
$query = "SELECT * FROM posts ";
$getAll_postsStatus = mysqli_query($connection, $query);
while ($row = mysqli_fetch_assoc($getAll_postsStatus)) {
$post_status = $row['post_status'];
}
if ($post_status != 'Published' ) {
echo "<h2>No Post found!</h2>";
} else {
echo "<h2>Found Posts!<h2>";
}