2021-10-30 19:02:07 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class News_model extends MO_Model
|
|
|
|
{
|
2021-11-14 11:02:22 +01:00
|
|
|
public function get_news($page)
|
|
|
|
{
|
|
|
|
$p = ($page - 1) * 5;
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$sql = "SELECT * FROM news LIMIT $p, 5";
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
$q = $this->db->query($sql);
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
return $q->result_array();
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function add_news($text, $uname)
|
|
|
|
{
|
|
|
|
$sql = "INSERT INTO news VALUES(default, '$uname', '$text')";
|
|
|
|
|
|
|
|
return $this->db->query($sql);
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
|
2021-11-14 11:02:22 +01:00
|
|
|
public function del_news($id)
|
|
|
|
{
|
|
|
|
$sql = "";
|
|
|
|
return $this->db->query($sql);
|
|
|
|
}
|
2021-10-30 19:02:07 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
//nowhitesp
|