PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, March 5, 2022

[FIXED] Codeigneiter return controller

 March 05, 2022     codeigniter, codeigniter-4     No comments   

Issue

How do I switch between controls in codeigneiter 4?

public function index()
    {
        $db = \Config\Database::connect();
        $query = $db->query('SELECT * FROM musste');
        $results = $query->getResultArray();
        $viewData = array("results" => $results);
        return view('index', $viewData);
    }

For example, what can I do to work this function again.I get an error when I use return view again.

public function login()
    {
      return view('index');
    }

is failing here


Solution

In login() function try to:

return $this->index();

instead of

return view('index');



Answered By - Russ_AB
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing