Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //basepath needs to be defined in order to include config file (there is a check for this!)
- define("BASEPATH", dirname(dirname(__FILE__)));
- //push all config details (config.details returns them as array) into this array
- $config = require_once("application/config/config.php");
- // DB CONNECTION DETAILS FOR LS
- $username = $config['components']['db']['username'];
- $password = $config['components']['db']['password'];
- $ls_dbprefix = $config['components']['db']['tablePrefix'];
- //the DB connection string looks like this:
- //'mysql:host=localhost;port=3306;dbname=etcvps88_devm;'
- //so we need to check for the last "=", add 1 and get the string without the ending ";" character:
- $database = substr($config['components']['db']['connectionString'],strrpos($config['components']['db']['connectionString'],"=")+1,-1);
- //connect to Limesurvey DB
- $ls_connect = mysqli_connect("localhost",$username,$password,$database) or die( "Unable connect to Limesurvey database '$database'");
- //set charset to deal with special characters
- mysqli_set_charset($ls_connect,'utf8');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement