Welcome Guest, Not a member yet? Register   Sign In
Cannot Retrieve the Correct Content
#1

(This post was last modified: 03-08-2024, 02:39 AM by demyr.)

Hi. That could be a silly problem but let me write: I send a request from my Controller to the model as usual to retrieve a page. To make everything certain I use id.

Controller:

Code:
$page = $this->PageModel->fetch_page($page_id);


However, I see that it duplicates the number in my Model and brings me the latest row. For example, if the id is 1, it makes it 11. 

My Model:

Code:
public function fetch_page($page_id){
      
        $db      = \Config\Database::connect();
        $builder = $db->table('pages as p');
        $query = $builder->select('*')
                        ->where('p.page_id', $page_id)
                        ->where('p.page_status', 1)
                        ->get();

        return $query->getRow();
      }

Btw, it's CodeIgniter version 4.4.6 - the latest one for now.

P.S. It is getting more interesting. Now, it doesn't duplicate but gets me the latest row again. I cleared the sessions but didn't work.

P.S 2: Interestingly when I print_r() the data in my controller the content is correct.
Reply


Messages In This Thread
Cannot Retrieve the Correct Content - by demyr - 03-08-2024, 02:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB