It's not working how? Do you get an error at all or it just seems to be ignored?
I think the problem is that after your IF you don't have an else to proceed with the adoption. So, even if your condition is true then it is not obeyed as something else later overrides it.
It should be...
PHP Code:
if($num >= 5){
$article_title = "Your companions have you busy!";
//$article_date = date('Y-m-d');
$article_content = "<b>You have too many young companions!
Please <a href='myadopts.php'>help your young companions reach age 5 or higher</a>
before adopting new companions.</b>";
}
else{
// The code to actually adopt a pet goes here...
// Wrap my existing code inside the else statement.
}