Skip to content
Browse files

the dbname for which analytics is required is stored in database

  • Loading branch information...
1 parent 872b3b7 commit 84043232577cd45c395554403d278f3612d3baff @rampr rampr committed
Showing with 14 additions and 4 deletions.
  1. +5 −3 classes/Charting/Sql/Db.php
  2. +9 −1 sample_conf.php
View
8 classes/Charting/Sql/Db.php
@@ -39,10 +39,10 @@ function db_connect()
print_r(mysql_error());
mysql_select_db(\Charting\CONFDB, $this->conf_connfb);
}
- $this->app_db_connect();
+ //$this->app_db_connect();
}
- function app_db_connect()
+ function app_db_connect($db)
{
if(!$this->connfb)
{
@@ -51,7 +51,7 @@ function app_db_connect()
{
exit("connecting to mysql failed");
}
- mysql_select_db($GLOBALS['DB'],$this->connfb);
+ mysql_select_db($db,$this->connfb);
}
}
@@ -134,7 +134,9 @@ public function getChartsForTab($id)
while($row = mysql_fetch_array($res, MYSQL_ASSOC))
{
$ids=$row['charts'];
+ $db = $row['db'];
}
+ $this->app_db_connect($db);
return $this->getSpecificCharts($ids);
}
View
10 sample_conf.php
@@ -2,6 +2,14 @@
const DBHOST = 'localhost';
const USER = 'myuser';
const PASS = 'mypass';
- $DB = 'mydb';
const CONFDB = 'mycharts';
+
+ define('Charting\APPURL','http://localhost/charting/');
+ define('Charting\PROJROOT', dirname(__FILE__) . '/' );
+
+ // Set autoload classpath for loading classes when object is created, avoiding
+ // the creation of include/require
+ $class_root = PROJROOT . 'classes';
+ require_once($class_root.'/Charting/ClassLoader.php');
+ ClassLoader::register($class_root);
?>

0 comments on commit 8404323

Please sign in to comment.
Something went wrong with that request. Please try again.