Welcome Guest, Not a member yet? Register   Sign In
dynamic $config array Concept
#1

[eluser]Mark LaDoux[/eluser]
Ok, this is just a concept, and isn't in actual use anywhere. This may not be the wisest or best solution, so use at your own risk.

Code:
<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* Retrieves configurations from database
*/

// This line is here just in case the database config hasn't been loaded yet,
// however, by adding the _once to it, it won't reload it if it's already in
// memory.
include_once(APPPATH.'config/database.php');

// Open our database connection
$con    = mysql_connect(
            $db[$active_group]['hostname'],
            $db[$active_group]['username'],
            $db[$active_group]['password']
);
mysql_select_db($db[$active_group]['database']);

// run our query
$sql        = "SELECT * FROM 'config'";
$cfg_qry    = mysql_query($sql, $con);

// grab an associative array and iterate through it
while ($row = mysql_fetch_assoc($cfg_qry))
{
    // set our config data
    $config[$row['name']]    = $row['value'];
}


Messages In This Thread
dynamic $config array Concept - by El Forum - 05-08-2010, 12:59 PM
dynamic $config array Concept - by El Forum - 05-08-2010, 01:48 PM
dynamic $config array Concept - by El Forum - 05-08-2010, 04:57 PM
dynamic $config array Concept - by El Forum - 05-08-2010, 05:09 PM
dynamic $config array Concept - by El Forum - 05-08-2010, 05:14 PM
dynamic $config array Concept - by El Forum - 05-08-2010, 05:29 PM
dynamic $config array Concept - by El Forum - 05-09-2010, 08:31 PM
dynamic $config array Concept - by El Forum - 05-10-2010, 02:29 AM
dynamic $config array Concept - by El Forum - 05-10-2010, 02:35 AM
dynamic $config array Concept - by El Forum - 05-10-2010, 09:03 AM



Theme © iAndrew 2016 - Forum software by © MyBB