Welcome Guest, Not a member yet? Register   Sign In
Database error in localhost
#1

i downloaded the website from server to localhost and getting the following error

PHP Code:
A Database Error Occurred
Unable to connect to your database server using the provided settings
.

Filenamecontrollers/Home.php

Line Number
24 


This is whats contained in the Home.php file

PHP Code:
    *         http://example.com/index.php/welcome
     
*    - or -
     *         
http://example.com/index.php/welcome/index
     
*    - or -
     * 
Since this controller is set as the default controller in
     
config/routes.phpit's displayed at http://example.com/
     *
     * So any other public methods not prefixed with an underscore will
     * map to /index.php/welcome/<method_name>
     * @see https://codeigniter.com/user_guide/general/urls.html
     */


        public function __construct(){
                parent::__construct();
                 $this->load->helper('
form');
                 $this->load->library('
user_agent');
                 $this->load->library('
paypal_lib');
                 $this->load->model('
Ad_model', 'Ad_user');
                 $this->load->model('
User_model', 'user_model');
              $this->load->library('
VRClient');
                 $this->load->library('
form_validation');
           } 



How do i resolve this?
Reply
#2

(This post was last modified: 02-20-2019, 09:03 PM by php_rocs.)

@scatman98,

Which one is line 24 (VRClient or form_validation)?

I'm surprised that you didn't do this instead: $this->load->library(array('user_agent','paypal_lib','VRClient','form_validation')) or
$this->load->library(['user_agent','paypal_lib','VRClient','form_validation'])
Are Ad_model and Ad_user two different models or are you using Ad_user as the object name same for User_model?
Reply
#3

I am guessing that your line 24 is the first time you try to load a model ('Ad_model).
The error message indicates that your database settings are incorrect.
Those are in application/config/database.php, or possibly an environment-specific folder inside that.
Reply
#4

(02-20-2019, 09:01 PM)php_rocs Wrote: @scatman98,

Which one is line 24 (VRClient or form_validation)?

I'm surprised that you didn't do this instead: $this->load->library(array('user_agent','paypal_lib','VRClient','form_validation')) or
                                              $this->load->library(['user_agent','paypal_lib','VRClient','form_validation'])
Are Ad_model and Ad_user two different models or are you using Ad_user as the object name same for User_model?

24th line is

               
Code:
parent::__construct();


okay thanks for telling me about this, im just getting started with programming. this is someone elses work which im trying to study.
Reply
#5

(02-21-2019, 01:27 AM)ciadmin Wrote: I am guessing that your line 24 is the first time you try to load a model ('Ad_model).
The error message indicates that your database settings are incorrect.
Those are in application/config/database.php, or possibly an environment-specific folder inside that.

yes you are right. the username and password were not specified.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB