에러코드 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in > 그누4 질문답변

매출이 오르면 내리는 수수료! 지금 수수료센터에서 전자결제(PG)수수료 비교견적 신청해 보세요!

그누4 질문답변

그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기
기존 게시물은 열람만 가능합니다.

에러코드 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in 정보

에러코드 Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in

본문

안녕하세여.
에러 코드 관련해서 질문 드립니다. 에러코드는 아래구여.

Warning: mysql_num_rows() expects parameter 1 to be resource, boolean given in /home/public_html/main.aft.login.php on line 289

제가 그누보드를 커스터마이징 해서 쓰려고 하는데여.
이게 뭐가 잘못 되었는지 개별 페이지로 접근을 하면 정상적으로 작동을 하는데
인덱스 페이지로 접속해서 들어가면 위와 같은 에러가 뜨는데여.
어느 부분이 잘못 되서 그런건지 지도 부탁드립니다. 꾸벅.

//main.aft.login.php


  $addresses = new Addresses($searchstring, $alphabet);
  $result = $addresses->getResults();
  $resultsnumber = mysql_num_rows($result); <!-- 이부분에서 위와 같은 에러가 납니다.

아래는 소스 입니다.

//index.php


<?php
include_once("./_common.php");
$g4['title'] = "";

// 외부로그인
function outlogin($skin_dir="basic")
{
    global $config, $member, $g4, $urlencode, $is_admin;

    $nick  = cut_str($member['mb_nick'], $config['cf_cut_name']);
    $point = number_format($member['mb_point']);

    $outlogin_skin_path = "$g4[path]/skin/outlogin/$skin_dir";

    // 읽지 않은 쪽지가 있다면
    if ($member['mb_id']) {
        $sql = " select count(*) as cnt from {$g4['memo_table']} where me_recv_mb_id = '{$member['mb_id']}' and me_read_datetime = '0000-00-00 00:00:00' ";
        $row = sql_fetch($sql);
        $memo_not_read = $row['cnt'];

        $is_auth = false;
        $sql = " select count(*) as cnt from $g4[auth_table] where mb_id = '$member[mb_id]' ";
        $row = sql_fetch($sql);
        if ($row['cnt'])
            $is_auth = true;
    }
    ob_start();
if ($member['mb_id']){
include_once("./head.aft.login.php");
        //include_once ("$outlogin_skin_path/outlogin.skin.2.php");
include_once("./main.aft.login.php");
include_once("./tail.aft.login.php");
}
else
    // 로그인 전
{
include_once("./head.b4.login.php");
        include_once ("$outlogin_skin_path/outlogin.skin.1.php");
include_once("./bbs/register.php");
include_once("./main.b4.login.html");
include_once("./tail.b4.login.php");
}
    $content = ob_get_contents();
    ob_end_clean();

    return $content;
}

include_once("$g4[path]/head.sub.php");
include_once("$g4[path]/tail.sub.php");

?>
<?=outlogin("basic"); // 외부 로그인 ?>

//main.aft.login.php


  $addresses = new Addresses($searchstring, $alphabet);
  $result = $addresses->getResults();
  $resultsnumber = mysql_num_rows($result); <!-- 이부분에서 위와 같은 에러가 납니다.

//여기에서 Addresses 함수를 참조하는 페이지
//address.class.php
<?
class Address {

    private $address; // mother of all data
   
    private $phones;
    private $emails;

    function __construct($data) {
    $this->address = $data;
    $this->phones = $this->getPhones();
    $this->emails = $this->getEMails();
    }

    public function getData() {
        return $this->address;
    }

    public function getEMails() {

      $result = array();
    if($this->address["email"]  != "")  $result[] = $this->address["email"];
    if($this->address["email2"]  != "") $result[] = $this->address["email2"];
    return $result;
    }

    public function firstEMail() {
      return (!empty($this->emails) ? $this->emails[0] : "");
    }

    public function getBirthday() {
    return new Birthday($this->address, "b");
    }

    //
    // Phone order home->mobile->work->phone2
    //
    public function getPhones() {

      $phones = array();
    if($this->address["home"]  != "") $phones[] = $this->address["home"];
    if($this->address["mobile"] != "") $phones[] = $this->address["mobile"];
    if($this->address["work"]  != "") $phones[] = $this->address["work"];
    if($this->address["phone2"] != "") $phones[] = $this->address["phone2"];
    return $phones;
  }

    public function hasPhone() {

      return !empty($this->phones);
  }

    public function firstPhone() {
      return (!empty($this->phones) ? $this->phones[0] : "");
    }

    //
    // Create a unified format for comparision an display.
    //
    public function unifyPhone( $prefix = ""
                              , $remove_prefix = false ) {
                             
      global $intl_prefix_reg, $default_provider, $phone_delims;
                             
    // Remove all optical delimiters
    $phone = $this->firstPhone();
    foreach($phone_delims as $phone_delim) {
    $phone = str_replace($phone_delim, "", $phone);
    }
               
    if($prefix != "" || $remove_prefix = true) {
   
      // Replace 00xxx => +xx
      $phone = preg_replace('/^00/', "+", $phone);
       
      // Replace 0 with $prefix (00 is already "+")
      if($prefix != "") {
        $phone = preg_replace('/^0/', $prefix, $phone);
      }
       
      // Replace xx (0) yy => xxyy
        $phone = preg_replace("/^(".$intl_prefix_reg.")0/", '${1}', $phone); 
               
      // Replace +xx with 0
      if($remove_prefix) {
      if(isset($default_provider)) {
      $remove_prefixes = str_replace("+", "\+",$default_provider);
      } else {
      $remove_prefixes = $intl_prefix_reg;
      }
      $phone = preg_replace("/^(".$remove_prefixes.")/", "0", $phone);
        }
      }

    return $phone;

    }

    //
    // Show the phone number in the shortes readable format.
    //
    public function shortPhone() {
    return $this->unifyPhone();
    }

}

class Addresses {

    private $result;

    function likePhone($row, $searchword) {
   
    global $phone_delims;
   
    $replace = $row;
    $like    = "'$searchword'";
    foreach($phone_delims as $phone_delim) {
      $replace = "replace(".$replace.", '".mysql_real_escape_string($phone_delim)."','')";
      $like    = "replace(".$like.  ", '".mysql_real_escape_string($phone_delim)."','')";
    }   
    return $replace." LIKE CONCAT('%',".$like.",'%')";   
    }

    function __construct($searchstring, $alphabet = "") {

    global $base_from_where, $table;

    $sql = "SELECT DISTINCT $table.* FROM $base_from_where";

      if ($searchstring) {

          $searchwords = explode(" ", $searchstring);

          foreach($searchwords as $searchword) {
          $sql .= "AND (  lastname  LIKE '%$searchword%'
                          OR firstname LIKE '%$searchword%'
                          OR company  LIKE '%$searchword%'
                          OR address  LIKE '%$searchword%'
                          OR ".$this->likePhone('home',  $searchword)."
                          OR ".$this->likePhone('work',  $searchword)."
                          OR ".$this->likePhone('mobile', $searchword)."
                          OR ".$this->likePhone('fax',    $searchword)."
                          OR email    LIKE '%$searchword%'
                          OR email2    LIKE '%$searchword%'
                          OR address2  LIKE '%$searchword%'
                          OR notes    LIKE '%$searchword%'
                          )";
          }
      }
      if($alphabet) {
      $sql .= "AND (  lastname  LIKE '$alphabet%'
                      OR firstname LIKE '$alphabet%'
                      )";
      }

      if(true) {
          $sql .= "ORDER BY lastname, firstname ASC";
      } else {
        $sql .= "ORDER BY firstname, lastname ASC";
      }

      //* Paging
      $page = 1;
      $pagesize = 2200;
      if($pagesize > 0) {
          $sql .= " LIMIT ".($page-1)*$pagesize.",".$pagesize;
      }
      //*/
      $this->result = mysql_query($sql);
    }

    public function nextAddress() {

    $myrow = mysql_fetch_array($this->result);
    if($myrow) {
      return new Address($myrow);
  } else {
      return false;
  }
    }

    public function getResults() {
    return $this->result;
    }
}
?>

댓글 전체

넵. 답변 감사합니다.
저도 그 이유는 알겠는데, 제가 잘 모르겠는건,
localhost/index.php로 접속하면 에러가 나고
localhost/main.aft.login.php로 접속하면 정상 작동하는게
왜 그러는건지 이해가 잘 안되서여..
제가 인덱스에서 로그인전과 로그인후 인덱스 페이지가 다르게 설정을 해놨거든여..ㅠㅠㅠㅠ
전체 66,558 |RSS
그누4 질문답변 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT