2014-01-14 2 views
-6

나는 오류가이 코드에서오고 오류가경고 : mysql_num_rows도는() 매개 변수 1 내 PHP 파일에서 주어진 자원, 부울있을 것으로 기대

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/quick/public_html/tvhd.in/xamii/Channel-Detail.php on line 62 


Warning: Cannot modify header information - headers already sent by (output started at /home/quick/public_html/tvhd.in/xamii/Channel-Detail.php:62) in /home/quick/public_html/tvhd.in/xamii/Channel-Detail.php on line 64 

는 하나 thatwould 괜찮을 도움이 될 것입니다있다

+0

참조 [이 답변] (http://stackoverflow.com/a/11674313/250259). –

+1

하루에 적어도 5 번 요청됩니다. 이 책들은 누구 책/독서가 있니? – Rottingham

+0

부울 값을 전달하지 않습니다. 뭐가 문제 야? (오, 당신이 거기에 빛을 비출 수있는 쿼리 또는 기타 정보가있을 수 있다는 것을 의미합니까? * 지옥 * 당신이 말하는) – Andrew

답변

0

오류 확인. 오류 검사. 오류 검사 중 !!!

// $result will be boolean FALSE if there is a failure in the query 
// This is not the same as if there were 0 results 
$result = mysql_query('SELECT * FROM SOMETABLE'); 

if (!$result) { 
    // The query has an error, so you can't use mysql_num_rows 
    die(mysql_error()); // <!-- This will tell you why. psuedo error checking! 
} 

// If we make it this far, its safe to use mysql_num_rows and $result 
$rows = mysql_num_rows($result); 

이제 mysql_로 기능 ​​를 사용 정지! 그들은 더 이상 사용되지 않습니다. 온라인 문서를 5 초만 보았을 때이 질문에 답을하고 mysql_을 사용하지 말라고했다. 큰 빨간 상자를보십시오. 이 문제를 해결하는 방법에 대한

http://us1.php.net/manual/en/function.mysql-query.php

관련 문제