2011-12-31 3 views
0

내 웹 사이트에서 mysql 키워드 검색을 사용하면 정상적으로 작동합니다. 문제는 누군가 내가 추가하지 않은 키워드를 검색 할 때 결과 페이지에 아무 것도 나타나지 않는 경우입니다. 아무것도 나타나지 않고 메시지를 찾지 못한 결과를 얻고 싶습니다. 나는이 코드를 사용할 필요가 들었다 :MYSQL에서 검색 결과가 발견되지 않으면 "결과가 없습니다"라는 메시지를 표시하는 방법은 무엇입니까?

<?php 
if (mysql_num_rows($rs_main) == 0) { 
    echo "No records found."; 
} 
?> 

를하지만 지난 며칠 내 코드 내에서 내가 그것을 얻이 수없는 이유로 그 코드를 구현하기 위해 노력했습니다. 누군가가 내 문제를 해결하기 위해 코드 내에서 위의 코드를 올바르게 구현할 수있는 위치와 방법을 미리 알려 주시면 감사하겠습니다. 미리 감사드립니다. 당신이 더 나은에서 메시지를 찾을 수 없습니다 "라는 검색 결과를"당신은 Dreamweaver를 사용하고 있기 때문에 단지 레코드 경우 빈 명령 쇼 지역을 추가, 내 문제를

<?php 
function buildNavigation($pageNum_Recordset1,$tot… | ",$max_links=10, $show_page=true) 
{ 
       GLOBAL $maxRows_Recordset1,$totalRows_Recordset… 
    $pagesArray = ""; $firstArray = ""; $lastArray = ""; 
    if($max_links<2)$max_links=2; 
    if($pageNum_Recordset1<=$totalPages_R… && $pageNum_Recordset1>=0) 
    { 
     if ($pageNum_Recordset1 > ceil($max_links/2)) 
     { 
      $fgp = $pageNum_Recordset1 - ceil($max_links/2) > 0 ? $pageNum_Recordset1 - ceil($max_links/2) : 1; 
      $egp = $pageNum_Recordset1 + ceil($max_links/2); 
      if ($egp >= $totalPages_Recordset1) 
      { 
       $egp = $totalPages_Recordset1+1; 
       $fgp = $totalPages_Recordset1 - ($max_links-1) > 0 ? $totalPages_Recordset1 - ($max_links-1) : 1; 
      } 
     } 
     else { 
      $fgp = 0; 
      $egp = $totalPages_Recordset1 >= $max_links ? $max_links : $totalPages_Recordset1+1; 
     } 
     if($totalPages_Recordset1 >= 1) { 
      # ------------------------ 
      # Searching for $_GET vars 
      # ------------------------ 
      $_get_vars = '';    
      if(!empty($_GET) || !empty($HTTP_GET_VARS)){ 
       $_GET = empty($_GET) ? $HTTP_GET_VARS : $_GET; 
       foreach ($_GET as $_get_name => $_get_value) { 
        if ($_get_name != "pageNum_Recordset1") { 
         $_get_vars .= "&$_get_name=$_get_value"; 
        } 
       } 
      } 
      $successivo = $pageNum_Recordset1+1; 
      $precedente = $pageNum_Recordset1-1; 
      $firstArray = ($pageNum_Recordset1 > 0) ? "<a href=\"$_SERVER[PHP_SELF]?pageNum_Record… : "$prev_Recordset1"; 
      # ---------------------- 
      # page numbers 
      # ---------------------- 
      for($a = $fgp+1; $a <= $egp; $a++){ 
       $theNext = $a-1; 
       if($show_page) 
       { 
        $textLink = $a; 
       } else { 
        $min_l = (($a-1)*$maxRows_Recordset1) + 1; 
        $max_l = ($a*$maxRows_Recordset1 >= $totalRows_Recordset1) ? $totalRows_Recordset1 : ($a*$maxRows_Recordset1); 
        $textLink = "$min_l - $max_l"; 
       } 
       $_ss_k = floor($theNext/26); 
       if ($theNext != $pageNum_Recordset1) 
       { 
        $pagesArray .= "<a href=\"$_SERVER[PHP_SELF]?pageNum_Record… 
        $pagesArray .= "$textLink</a>" . ($theNext < $egp-1 ? $separator : ""); 
       } else { 
        $pagesArray .= "$textLink" . ($theNext < $egp-1 ? $separator : ""); 
       } 
      } 
      $theNext = $pageNum_Recordset1+1; 
      $offset_end = $totalPages_Recordset1; 
      $lastArray = ($pageNum_Recordset1 < $totalPages_Recordset1) ? "<a href=\"$_SERVER[PHP_SELF]?pageNum_Record… : "$next_Recordset1"; 
     } 
    } 
    return array($firstArray,$pagesArray,$lastArray… 
} 
?> 
<?php require_once('Connections/theconnect.php… ?> 
<?php 
if (!function_exists("GetSQLValueString")) { 
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{ 
    if (PHP_VERSION < 6) { 
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue; 
    } 

    $theValue = function_exists("mysql_real_escape_strin… ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue); 

    switch ($theType) { 
    case "text": 
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
     break;  
    case "long": 
    case "int": 
     $theValue = ($theValue != "") ? intval($theValue) : "NULL"; 
     break; 
    case "double": 
     $theValue = ($theValue != "") ? doubleval($theValue) : "NULL"; 
     break; 
    case "date": 
     $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL"; 
     break; 
    case "defined": 
     $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue; 
     break; 
    } 
    return $theValue; 
} 
} 
$maxRows_Recordset1 = 5; 
$pageNum_Recordset1 = 0; 
if (isset($_GET['pageNum_Recordset1'])) { 
    $pageNum_Recordset1 = $_GET['pageNum_Recordset1']; 
} 

$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1; 

$colname_Recordset1 = "-1"; 
if (isset($_GET['textfield'])) { 
    $colname_Recordset1 = $_GET['textfield']; 
} 
+1

당신이 사용하라고 말한 코드를 사용하고 있지 않습니다. 어디에서 사용하려고 했습니까? –

+0

$ theValue = ($ theValue! = "")? $ theDefinedValue : $ theNotDefinedValue; 휴식; $ maxRows_Recordset1 = 5; – Will

답변

0

을 이해하지 않고 둘 수 있도록

여기 내 코드입니다.