This is my code, the first function. fun.php
function post_exists($post_id){
global $con;
$post_id = (int)$post_id;
return (mysqli_fetch_array(mysqli_query($con, "SELECT COUNT(post_id) FROM home_post WHERE post_id='$post_id'"), MYSQLI_NUM) != 0) ? true : false;
}
This is the function call in index.php
if(post_exists(23) === true){
echo "<script>alert('working oo')</script>";
}
function usually return true when the argument is false. what i want is, if the argument is true(which means if the data exist in my database)return true if is false return false .