Location: PHPKode > projects > Top Music module > Top Music 3.0.7/html/modules/topMusic/lib/com/sergids/topmusic/model/ConfigDAO.php
<?php
require_once("ConfigO.php");
/**
* Configuration Data Access Object
* @author sergi
* @copyright Copyright &copy; 2005, sergi
*/
class ConfigDAO{
	var $db;
	var $prefix;
	/**
	* The constructor
	* @param DB db database object
	* @param string prefix phpnuke database tables prefix
	* @return void
	* @author sergi
	*/
	function ConfigDAO($db,$prefix="nuke"){
		$this->db=$db;
		$this->prefix=$prefix;
	} 
	/**
	* Get configuration object
	* @return ConfigO Configuration object
	* @author sergi
	*/
	function load(){
		$configO=new ConfigO();
		$sSql="SELECT * from  
		  ".$this->prefix."_topmusic_config";
		//echo "sql=".$sSql."<br>";
		$stmt=$this->db->sql_query($sSql);
		$num_columns=$this->db->sql_numfields($stmt);
		for($i=0;$i<$num_columns;$i++){
			$columns[]=$this->db->sql_fieldname($i);
		}
		//die(var_dump($columns));
		if($rs=$this->db->sql_fetchrow($stmt)){
			foreach($columns as $column){
				$configO->{$column}=$rs[$column];
			}
		}
		$this->db->sql_freeresult($stmt);
		return $configO;
	}
	/**
	 * Get Nuke language
	 * @return string language
	 * @author sergi
	 */
	function getNukeLanguage(){
		$sSql="SELECT language FROM ".$this->prefix."_config";
		$result = $this->db->sql_query($sSql);
		if($rs=$this->db->sql_fetchrow($stmt)){
			$language=$rs["language"];
		}
		$this->db->sql_freeresult($stmt);
		return $language;
	}
	
}
?>
Return current item: Top Music module