Welcome Guest, Not a member yet? Register   Sign In
use paginate() on custom function
#4

Try this one, you where missing the semi-colons in the sql statements.

PHP Code:
public function get_corsi_modulo($tipologia_corsi null$id_argomenti null)
{
    $db = \Config\Database::connect();
    
    $req
="SELECT * FROM ".$this->table." where banned='no' and status='si';";

    if ( ! is_null($tipologia_corsi))
    {
        $req.=" and tipologia_corsi='".$db->escapeString($tipologia_corsi)."';";
    }

    if ( ! is_null($id_argomenti))
    {
        $req.=" and id_argomenti='".$db->escapeString($id_argomenti)."';";
    }

    $query $db->query($req);

    return $this;
}

// You need to pass them to the view with $data.
$data = [
    'posts' => $posts->getLivePosts()->paginate(3),
    'pager' => $posts->pager,
];

// What ever your view is.
echo view('Insitefx\Blog\Views\posts\index'$data);

$CorsiModel->get_corsi_modulo($params['tipologia'], null)->paginate(10); 

---------------------------------------------------

// CONTROLLER

public function someFunction()
{
    $pager = \Config\Services::pager();

    // You need to pass them to the view with $data.
    $data = [
        'posts' => $posts->getLivePosts()->paginate(3),
        'pager' => $posts->pager,
    ];

    // What ever your view is.
    echo view('Insitefx\Blog\Views\posts\index'$data);

    $CorsiModel->get_corsi_modulo($params['tipologia'], null)->paginate(10); 
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )
Reply


Messages In This Thread
use paginate() on custom function - by pws - 08-10-2020, 03:33 AM
RE: use paginate() on custom function - by pws - 08-10-2020, 06:53 AM
RE: use paginate() on custom function - by InsiteFX - 08-10-2020, 08:20 AM



Theme © iAndrew 2016 - Forum software by © MyBB