Oh boy that went quite fast with your comment, even before mine :P
So, the answer is simple: You can't use mysql_num_rows
on a PDO
connection. That are two different drivers. Thats like you try to start the car of your wife with your own keys. Principally, both are keys, but they don't work with any car.
Its the same here in your case. mysql_num_rows
comes from the OUTDATED mysql driver. (Don't use mysql_* at all, its not longer supported in PHP7 and deprecated). To do it with PDO is the right way, but you have to adapt your code a bit.
$Name=$_COOKIE['PName'];
$sql = "select count(sysnum) from hpc where handler='".$Name."' and stat='N';";
$sel=$conn->query($sql);
$rows = $sel->rowCount();
echo $rows;
Hope that work, if not, let me know. I know I had some troubles the last time I tried to do a rowCount with PDO.
IMPORTANT - DANGER:
Also I really recommend you to take a look at http://bobby-tables.com and learn something about SQL injection. Your code actually is not save at all and your database can be hacked quite easy. Since you're using PDO, nothing stops you from using prepared statements, what would make your code much better.
Hope I could help you. If you have any other questions or something shouldn't work, please let me know.