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
Post a Comment