PHP分页在本地版本上工作正常,但在服务器上不工作

时间:2019-03-10 06:57:52

标签: php

我是PHP编程的新手,我在php中编写了一个分页脚本,以在值超过特定限制时显示页码。我已经在本地(在Wamp中)测试了脚本,该脚本在本地服务器上按预期工作。但是当涉及到live / prod版本时,相同的代码在那里不起作用。

添加代码的详细信息,请帮助您

<div class="postarea">

<?php 
include('includes/db.php');
$noresults =8;
$stmt= $connection->prepare( "select j_id, gender, class, subject, location, cname, cno, time, pay, skill, experience, cdate from tutorjob order by 1 desc");
$stmt->execute();


$stmt->bind_result($j_id,$gender, $class, $subject, $location, $cname, $cno, $time, $pay, $skill, $experience, $cdate);
while($stmt->fetch())

{


    //$description=substr($row['content'],0,200);
    //$image=$row['image'];
    ?>



<?php
}
$count = $stmt->num_rows;

?>

<?php 

if (!isset($_GET['page'])) {
    $page = 1;
}else { 
$page= $_GET['page'];
}

$tpr = ($page-1)*$noresults;
 $nopages = ceil($count/$noresults);


 $stmt1= $connection->prepare( "select j_id, gender, class, subject, location, cname, cno, time, pay, skill, experience, cdate from tutorjob order by 1 desc limit ?,?");
 $stmt1->bind_param("ss", $tpr, $noresults);
$stmt1->execute();

$stmt1->bind_result($j_id, $gender, $class, $subject, $location, $cname, $cno, $time, $pay, $skill, $experience, $cdate);
while($stmt1->fetch())

{


    //$description=substr($row['content'],0,200);
    //$image=$row['image'];
    ?>

    <div class="entry">


    <table>
<tr>

   <th colspan="4"><i class="fas fa-paperclip"></i><b> Job Expiry Date</b> &nbsp; <?php echo $cdate; ?></th>

     </tr>
      <tr><td class="hd">
     Gender </td><td> <?php echo $gender; ?>
     </td><td class="hd">
     Class </td><td><?php echo $class; ?> 
     </td></tr><tr><td class="hd">
     Subject </td><td><?php echo $subject; ?> 
     </td><td class="hd">
     Location </td><td><?php echo $location; ?> 
     </td></tr><tr><td class="hd">
     Contact Name </td><td><?php echo $cname; ?> 
      </td><td class="hd">
     Contact Number </td><td><?php echo $cno; ?> 
     </td></tr><tr><td class="hd">
     Experience </td><td><?php echo $experience; ?> 
     </td><td class="hd">
     Pay </td><td><?php echo $pay; ?> 
      </td></tr>
      <tr>
     <td class="hd">
    <b>Skills Required </b> </td><td  colspan="3"><?php echo $skill; ?>  
      </td>
     </tr>
       <th colspan="4"><div class="link"><i class="fas fa-envelope-open"></i><a href="tutorregister.php">Register/Apply for the job</a></div></th> 
</table>
</div> 
 <?php
}
?>
<div class="pga">
<?php
?>
 <?php
for ($page=1;$page<=$nopages;$page++) {
  echo  '<div class="pg"> <a href="'.$_SERVER['PHP_SELF'].'?page='.$page.'">' . $page. '</a> </div> ' ;
?>

<?php
}
?>
</div>
</div>

0 个答案:

没有答案