Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8931127
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T09:02:40+00:00 2026-06-15T09:02:40+00:00

I am working on a codeigniter project. I developed it using wampserver locally, but

  • 0

I am working on a codeigniter project. I developed it using wampserver locally, but I’d like to make some changes with xampp . It works fine on the remote site. Unfortunately when I try to run it locally I am getting:

A Database Error Occurred
Unable to connect to your database server using the provided settings.
Filename: F:\xampp-portable\htdocs\....\database\DB_driver.php
Line Number: 124

to my index.php file , I have added:

mysql_connect("localhost","root","") or die ("Could not connect to mysql server.");
mysql_select_db("contacts_db") or die ("Could not connect to database.");

This does NOT generate an error. Can anyone give me some pointers on what to check next?

Thanks in advance,

Bill

OK guys, here is the code around line 124:

function initialize()
{
    // If an existing connection resource is available
    // there is no need to connect and select the database
    if (is_resource($this->conn_id) OR is_object($this->conn_id))
    {
        return TRUE;
    }

    // ----------------------------------------------------------------

    // Connect to the database and set the connection ID
    $this->conn_id = ($this->pconnect == FALSE) ? $this->db_connect() : $this-        >db_pconnect();

    // No connection resource?  Throw an error
    if ( ! $this->conn_id)
    {
        log_message('error', 'Unable to connect to the database'); // 124

        if ($this->db_debug)
        {
            $this->display_error('db_unable_to_connect');
        }
        return FALSE;
    }

John was right, although I am now confused. I had set up the following code in my index.php to auto switch between xampp and server database config files:

define('ENVIRONMENT', isset($_SERVER['SERVER_NAME'])=='my_domain_name.com' ? 'production' : 'development');

    echo 'SERVER_NAME  '.$_SERVER['SERVER_NAME']; // getting localhost
    echo 'env '.ENVIRONMENT; // getting production.

I thought this would result in the ENVIRONMENT constant set to ‘development’ with $_SERVER[‘SERVER_NAME’]=localhost. Would someone mind explaining what I’m doing wrong here?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T09:02:41+00:00Added an answer on June 15, 2026 at 9:02 am

    Please check your config/database.php file, as I know the config database in codeigniter is in this file. Some values you need to pay attention are:

    $db['default']['hostname'] = '';
    $db['default']['username'] = '';
    $db['default']['password'] = '';
    $db['default']['database'] = '';
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a small project, where I'm using the codeigniter php framework, but
I have created a login system in codeigniter project, which is working fine in
I am using PHP and the codeigniter framework for a project I am working
I currently have a web project developed with Codeigniter. My production environment works as
I am working in codeigniter project I want to rewrite my URL using htaccess.
I’m working on some script and I would like to create search. My project
I'm working on a CodeIgniter project and I'm newbie to ajax/jquery. I'm using fullCalendar.
I'm using CodeIgniter for a project I'm working on. I have an ajax call
I am working on a project that's developed with the CodeIgniter framework. My project
I've been working on a home project using CodeIgniter Reactor, and have come to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.