I have a php code snippet like below :
function is_ancestor_of( $page_name = null, $post ) {
if(is_null($page_name))
return false;
// does
Yeah, you can do this. Multiple ways:
EDITED Emphasized PDO as compared to the previous version of this answer as PDO is far more safer than the other options and there is a lot more to it which can be used while working with PHP and MySQL.