public function doesUserExist($u) {
$this->dbConnect();
mysql_select_db($this->database);
$sUser = mysql_real_escape_string($u);
$query = "SELECT username FROM $this->table WHERE username='$sUser'";
$doesFieldExist = false;
if (mysql_num_rows($query) > 0) {
$doesFieldExist = true;
}
$this->dbDisconnect();
return $doesFieldExist;
}
"mysql_num_rows도()는 매개 변수 1 자원이 될 것으로 기대"(60)mysql_num_rows도주는 에러 I이 광고에 오류가
if (mysql_num_rows($query) > 0) {
오류는 다음으로
Warning: mysql_num_rows() expects parameter 1 to be resource, string given in C:\Users\Tom\Dropbox\public_html\classes\database.class.php on line 60
mysql_num_rows ($ query)는 1을 리턴해야한다. 나는 여기를 봤는데, 내가 잘못한 것을 볼 수는 없다.
이$query = "SELECT username FROM $this->table WHERE username='$sUser'";
$doesFieldExist = false;
// Execute the query with mysql_query()
$result = mysql_query($query);
// $result is a result resource that can be passed
// to mysql_num_rows() unless the query failed and $result is FALSE
if ($result && mysql_num_rows($result) > 0) {
$doesFieldExist = true;
}
가능 중복 [PHP MySQL을 파라메타 1 mysqli_result 될 mysqli_num_rows()는 예상 주어진 부울 (http://stackoverflow.com/questions/2546314/php-mysql-mysqli-num-rows- expects-parameter-1-mysqli-result-boolean) –
이 질문은 여러분의 질문에 제목을 입력 할 때마다 '제안 된 링크'가 중복 된 것으로 보이는 무서운 추세가되고 있습니다. Google에는 160 만 개의 결과가 있습니다. –