How to check SQL(mysql ) result. PHP -


in php.mysql ($sql) result should 1.sysum should not empty in word, mysql_num_rows($sel) > 0 should true.

but actually,mycode can not work.i don't know why.who can me?

$conn = new pdo('mysql:host=localhost;port=3306;dbname=hpc' , 'root' , 'yd'); $name=$_cookie['pname']; $sql = "select sysnum hpc handler='".$name."' , stat='n';"; $sel=$conn->query($sql); if(mysql_num_rows($sel) > 0) {         mycode; } 

fetch result array , count items using count function, this:

$name=$_cookie['pname']; $sql = "select sysnum hpc handler='".$name."' , stat='n';"; $sel = $conn->query($sql)->fetchall(); if(count($sel) > 0){         mycode; } 

Comments

Popular posts from this blog

node.js - Node js - Trying to send POST request, but it is not loading javascript content -

javascript - Replicate keyboard event with html button -

javascript - Web audio api 5.1 surround example not working in firefox -