我试图添加限制时,每次按钮被点击,但不起作用
我的html代码是
<div class="media stream load-more">
<a href="<?php echo $_SERVER['PHP_SELF']; ?>" method ='post' name = 'showmore'>
<i class="icon-refresh shaded"></i>
show more...
</a>
</div>
php代码是
$showvalue = 2;
if(isset($_POST['showmore'])) {
$showvalue += 1;
}
$feeds = $db->getfeeds($showvalue);
mysql函数
public function getfeeds($showvalue){
$stmt = $this->con->prepare("SELECT id,image,title,status,profilepic,created_at,url FROM news ORDER BY id DESC LIMIT $showvalue");
$stmt->bind_param("s",$showvalue);
$stmt->execute();
$result = $stmt->get_result();
$nrow = array();
while ($r = $result->fetch_assoc()) {
$nrow[] = $r;
}
$frow['news'] = $nrow;
$json = str_replace("\\/", "/",json_encode($frow));
return $json;
}
暂无答案!
目前还没有任何答案,快来回答吧!