用PHP的下一个和上一个按钮

时间:2015-09-19 02:19:32

标签: php mysql

我一直在使用连接到mysql数据库的php网页获取下一个和上一个按钮的问题。我不确定有什么问题,但我认为它可能与偏移有关。现在按钮不起作用你点击它们没有任何反应。此表格也作为搜索页面。

以下是搜索代码:

word-break, white-space, etc.

以下是显示数据库结果的代码

<?php
     include("../web-admin/dbconfiginc.php");
 $result = mysql_query("SELECT * FROM videos WHERE ID = '$ID'");
 $row = mysql_fetch_array($result);

 ?><strong></strong>

<title>Search </title>

</head>

<body>

<table align="center" width="1024" border="0">

  <tr>
    <td valign="top" align="center" width="70%" style="padding-top:10px;" class="lhc">


<div align="center" style="margin-top: 50px; padding-bottom: 50px;">
<?php 

$Keyword = $_POST['Keyword'];
$GuestName = $_POST['GuestName'];
$Day = $_POST['Day'];
$Month = $_POST['Month'];
$Year = $_POST['Year'];

  if(isset($cancel))
  {
    header("Location:index.php");
    exit;
  }

  $qry_string = "SELECT * FROM videos "; 
  $search = "";

  if(!empty($Keyword))

  {
    $End_String = "(Blurb LIKE '%$Keyword%' OR Title LIKE '%$Keyword%')";
    $search .="&Keyword=$Keyword";
  }

  if(!empty($GuestName))
  {
    if(isset($End_String))
    {
      $End_String .= " AND (GuestName LIKE '%$GuestName%')";
    }
    else
    {
      $End_String = "(GuestName LIKE '%$GuestName%')";
     }
    $search .="&GuestName=$GuestName";
  }

  if(!empty($Day))
    {
    if(isset($End_String))
    {
      $End_String .= " AND (DAYOFMONTH(Publish_Date) = '$Day')";
    }
    else
   {
     $End_String = "(DAYOFMONTH(Publish_Date) = '$Day')";
    }
    $search .="&Day=$Day";
  }

  if(!empty($Month))
  {
    if(isset($End_String))
  {
  $End_String .= " AND (MONTH(Publish_Date) = '$Month')";
   }
   else
   {
  $End_String = "(MONTH(Publish_Date) = '$Month')";
}
$search .="&Month=$Month";
  }

  if(!empty($Year))
  {
    if(isset($End_String))
  {
   $End_String .= " AND (YEAR(Publish_Date) = '$Year')";
}
else
{
  $End_String = "(YEAR(Publish_Date) = '$Year')";
}
$search .="&Year=$Year";
}

  if(!empty($Active))
  {
    if(isset($End_String))
    {
      $End_String .= " AND (GuestName LIKE '%$GuestName%')";
    }
    else
    {
      $End_String = "(GuestName LIKE '%$GuestName%')";
    }
    $search .="&GuestName=$GuestName";
   }

   if (!isset($offset)) $offset=0;

  if(isset($End_String))
  {
    $qry_string = $qry_string." WHERE ".$End_String . "ORDER BY Publish_Date DESC LIMIT $offset, 101";
  }
  else
  {
    $qry_string = $qry_string."ORDER BY Publish_Date DESC LIMIT $offset, 101";
  }

  $result = mysql_query($qry_string);
  echo mysql_error();
?>

非常感谢一些帮助,试图弄清楚这一点或正确方向的一些点。谢谢!

0 个答案:

没有答案