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

  • Home
  • SEARCH
  • 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 8111787
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:14:57+00:00 2026-06-06T02:14:57+00:00

Hey guys was hoping you could help me out. basically i’m working on a

  • 0

Hey guys was hoping you could help me out.

basically i’m working on a website created using codeigniter by someone else. The site has two instances, one for development and one for live. The site is still under construction which means files are constantly being changed and moved from the development site (after being tested) to the live site.

Now the thing is, the person who initially created the site made some database calls from a few views. And to access the database from the view, he manually connected to the database from the view, i.e using

$db=mysql_connect(...);
mysql_select_db(...);

This means that each time a view is changed, before copying the files from the dev site to the live site, we need to change the variables inside these views.

moving all queries to models, and then calling them through controllers would take too long, so was wondering if there was a way through which i could access the database variables in the database.php file and pass them as the variable for mysql_connect.

i tried $this->db->database but get the error “Undefined property: CI_Loader::$db”

thanks in advance

  • 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-06T02:14:58+00:00Added an answer on June 6, 2026 at 2:14 am

    Define constants in constant.php assign them database username , password , host name etc and use them anywhere you want

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hey guys was hoping you could help me out, Not sure if I always
hey guys was hoping you could help me out, I am relatively new to
hey guys was hoping you could help me out.. The task seems simple but
Hey guys was hoping you could help me out I have a form, with
hey guys was hoping you could help me out.. just to let u know
hey guys was hoping you could help me out.. i was asked to fix
hey guys was hoping you could help me out. I am trying to make
Hey guys hoping for a little help here. First I created a working map
Hey guys was hoping you can help me out. been at this for like
Hey guys, hoping for some help with this :( been stuck on it for

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.