Skip to content

Commit fd48802

Browse files
committed
current number bug fixed
1 parent fbb2b04 commit fd48802

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

func.php

+8-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,9 @@ function del(){
150150
* render data to markdown text
151151
*/
152152
function render(){
153-
$data=get_db()->get_all();
154-
$current=$data[count($data)-1]['number'];
153+
$mdb=get_db();
154+
$data=$mdb->get_all();
155+
$current=$mdb->current_number();
155156
$content="码农周刊分类整理
156157
======
157158
码农周刊的类别分的比较大,不易于后期查阅,所以我把每期的内容按语言或技术进行了分类整理。
@@ -328,5 +329,10 @@ function add($data){
328329
function get_all(){
329330
return $this->pdo->query('select * from issue order by category,addtime')->fetchAll(PDO::FETCH_ASSOC);
330331
}
332+
333+
function current_number(){
334+
$rs=$this->pdo->query('select max(number) as max from issue')->fetch(PDO::FETCH_ASSOC);
335+
return $rs['max'];
336+
}
331337
}
332338
?>

0 commit comments

Comments
 (0)