在我的php.Mysql($ sql)結果應該是1.Sysum不應該是空的另一個詞,mysql_num_rows($sel) > 0
應該是true
。如何檢查SQL(mysql)結果。 PHP
但實際上,mycode無法工作。我不知道爲什麼。誰能幫助我?
$conn = new PDO('mysql:host=localhost;port=3306;dbname=hpc' , 'root' , 'Yd');
$Name=$_COOKIE['PName'];
$sql = "select sysnum from hpc where handler='".$Name."' and stat='N';";
$sel=$conn->query($sql);
if(mysql_num_rows($sel) > 0)
{
mycode;
}
我的conn是$ conn = new PDO('mysql:host = localhost; port = 3306; dbname = hpc','root','Yd'); – john
你能告訴我們你的連接嗎? '$ conn'裏面有什麼?你用mysql,mysqli或PDO來連接數據庫嗎? – Twinfriends
不要使用'mysql_ *'函數......它們已被棄用。並且肯定不會直接從cookie中解析出您的查詢... – Ivar