开发者

CodeIgniter database issues

开发者 https://www.devze.com 2023-04-10 16:06 出处:网络
I\'ve got a friend who\'s having trouble with his site that\'s using CodeIgniter. Unfortunately, I\'m not familiar enough with CodeIgniter, so I thought I\'d get one of you experts to quickly answer t

I've got a friend who's having trouble with his site that's using CodeIgniter. Unfortunately, I'm not familiar enough with CodeIgniter, so I thought I'd get one of you experts to quickly answer two questions:

  1. The site is mtyedjs[.]com. On the homepage, when you click "create a profile" on the right, it goes to http://mty开发者_如何学Cedjs.com/index.php/home/create_account. Instead it should be going to http://mtyedjs.com/application/views/create_account.php. Where do I go to change this?

  2. Also, when going to the appropriate create_account.php page above, there is a database connection error. All the information in config/database.php is correct. What is the issue?


If you read CodeIgniter's manual, you'll understand that the path http://mtyedjs.com/index.php/home/create_account means that you should have a controller named 'home' and a method 'create_account' inside it. Then this path will be valid path (of course if you don't have you own routes).

http://mtyedjs.com/application/views/create_account.php - this is not right. create_account.php - this is you view file, because it in the views folder. Read about the MVC-model - it'll be clear to understand what I mean. So you should load this view in your method 'create_account'; it'll be something like this:

class Home extends CI_Controller {
    function __construct() {
        parent::__construct();
    }

    function create_account() {
        $this->load->view('create_account');
    }
}
0

精彩评论

暂无评论...
验证码 换一张
取 消