mirror of
https://github.com/claudehohl/Stikked.git
synced 2025-04-25 12:31:06 -05:00
random improvement
This commit is contained in:
parent
c69548107c
commit
27106f39c4
@ -100,13 +100,6 @@ class Api extends Main
|
|||||||
{
|
{
|
||||||
$this->load->model('pastes');
|
$this->load->model('pastes');
|
||||||
$data = $this->pastes->random_paste();
|
$data = $this->pastes->random_paste();
|
||||||
|
|
||||||
if (!$data)
|
|
||||||
{
|
|
||||||
$data = array(
|
|
||||||
'message' => 'Please try again',
|
|
||||||
);
|
|
||||||
}
|
|
||||||
echo stripslashes(json_encode($data));
|
echo stripslashes(json_encode($data));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -583,8 +583,8 @@ class Pastes extends CI_Model
|
|||||||
function random_paste()
|
function random_paste()
|
||||||
{
|
{
|
||||||
$this->load->library('process');
|
$this->load->library('process');
|
||||||
$paste_id = rand(1, $this->countPastes());
|
$this->db->order_by('id', 'RANDOM');
|
||||||
$this->db->where('id', $paste_id);
|
$this->db->limit(1);
|
||||||
$query = $this->db->get('pastes');
|
$query = $this->db->get('pastes');
|
||||||
|
|
||||||
if ($query->num_rows() > 0)
|
if ($query->num_rows() > 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user