我不知道我试图将数据库与我的面板连接但它给出了一些错误任何帮助将被赞赏........................ .................................................. .........................................
<?php
if (!(isset($pagenum)))
{
$pagenum = 1;
}
$qry = "SELECT * FROM posts LIMIT 0,3";
$result = mysqli_query($qry,$con);
$rows = mysqli_num_rows($qry);
$page_rows = 3;
$last = ceil($rows/$page_rows);
if ($pagenum < 1)
{
$pagenum = 1;
}
elseif ($pagenum > $last)
{
$pagenum = $last;
}
$max = 'limit ' .($pagenum - 1) * $page_rows .',' .$page_rows;
$j=0;
$qry ="SELECT * FROM posts $max";
$result = mysqli_query($con,$qry);
//This is where you display your query results
while($rows = mysqli_fetch_array($result))
{
$j++;
echo "<p>";
// This shows the user what page they are on, and the total number Query and Results of pages
echo " --Page $pagenum of $last--
<p>";
// First we check if we are on page one. If we are then we don't need a
//link to the previous page or the first page so we do nothing. If we aren't
//then we generate links to the first page, and to the previous page.
if ($pagenum == 1)
{
}
else
{
echo " <a
href='{$_SERVER['PHP_SELF']}?pagenum=1'>
<<-First</a>
";
echo " ";
$previous = $pagenum-1;
echo " <a
href='{$_SERVER['PHP_SELF']}?
pagenum=$previous'> <-Previous</a>
";
}
//just a spacer
echo " ---- ";
//This does the same as above, only checking if we are on the last page,
//and then generating the Next and Last links
if ($pagenum == $last)
{
}
else {
$next = $pagenum+1;
echo " <a
href='{$_SERVER['PHP_SELF']}?pagenum=$next'>Next
-></a> ";
echo " ";
echo " <a
href='{$_SERVER['PHP_SELF']}?pagenum=$last'>Last
->></a> ";
}
?>
答案 0 :(得分:0)
echo $_SESSION['username'];
如果您在成功登录后在会话中保存$ _POST用户名,那么会不会这样做。理想情况下,我们确实需要查看您正在使用的PHP代码,但这是如何实现您的目标的基本思路