【发布时间】:2014-05-14 01:53:18
【问题描述】:
虽然没有显示它仍然无法工作的错误消息,但我在使我的分页工作时遇到问题。
我怀疑我必须与此代码有关。请帮帮我。 TIA 伙计们。
while($runrows=mysql_fetch_assoc($run, $limit))
下面是页面代码
<?php
$connect = mysql_connect($m_Host,$m_User,$m_Pass) or die(mysql_error());
echo "<br />";
mysql_select_db($m_Db,$connect) or die(mysql_error());
error_reporting(error_reporting()&~E_NOTICE);
if(isset($_POST['search_query']))
{
$search_query=mysql_real_escape_string(htmlentities($_POST['search_query']));
echo "<div class=\"searchText\"><br><b class='float'>Search the knowledgebase</b></div><br><hr />";
$search_query_x=explode(" ",$search_query);
foreach($search_query_x as $search_each)
{
$x++;
if($x==1)
$construct.="Tags LIKE '%$search_each%'";
else
$construct.="AND Tags LIKE '%$search_each%'";
}
$construct="SELECT * FROM knowledgebase WHERE $construct";
$run=mysql_query($construct);
$foundnum=mysql_num_rows($run);
if($foundnum==0)
{
echo "Sorry, there is no matching result for your query: <i><b>$search_query</b></i><br /><br />
1. Please check your spelling.<br />
2. Try more general terms.<br />
3. Please check broader alternatives like Google.<br />
4. Contact your <b>Floorwalker</b> or <b>Process Analyst</b>.<br />
5. If you found the solution to this scenario somewhere else, please advise your <b>Knowledge Manager</b>.";
}
else
{
echo "$foundnum result(s) found!<p>";
while($runrows=mysql_fetch_assoc($run, $limit))
{
$Document_Title=$runrows['Document Title'];
$URL=$runrows['URL'];
$Target_Account=$runrows['Target Account'];
$Modified=$runrows['Modified'];
$Tags=$runrows['Tags'];
echo"
<div class='width: 400px'>
<div class='Document Title'><a href='$URL' title='$Document_Title 
$Target_Account 
 $Modified 
$Tags' target='_blank'>$Document_Title</a></div>
<div class='Target Account'>
<b><font face='arial' size='1' color='Black'>Program:</font></b>
<font face='arial' size='1' color='Black'>$Target_Account</font></div>
<div class='Keywords'>
<b><font face='arial' size='1' color='Black'>Keywords:</font></b>
<font face='arial' size='1' color='Black'>$Tags</font></div>
</div>
<br />
";
}
}
}
else
{
echo"Found what you were looking for? If not, please consult your Process Analyst.";
}
//to make pagination
require_once('config.php');
include_once ('php\function.php');
$page = (int) (!isset($_GET["page"]) ? 1 : $_GET["page"]);
$limit = 5;
$startpoint = ($page * $limit) - $limit;
$statement = "`knowledgebase` where `active` = 1";
?>
<?php
echo pagination($statement,$limit,$page);
?>
【问题讨论】:
标签: php pagination