Location: PHPKode > projects > NAR contents manager > software/libs/BD.php
<?
//Implementación de la clase que se dedica al control de las bases dedatos

class db_handling {
	//atributos
	var $connection2;
	var $queryresult;
	var $finalresult;
	var $arrayfinalresult;
	var $error;

    //métodos 
	function connection(){
		//Servidor donde se aloja la BD
		/*s*/$server="localhost";


		

		//username de acceso al servidor de BD
		/*u*/$user="root";




		//password de acceso al servidor de BD
		/*p*/$password="";




		//Nombre de la BD
		//$database="gestornoticias"; 
		///*d*/$database="gestor";



		
		$this->connection2 = mysql_connect($server,$user,$password);
		//mysql_select_db($database,$this->connection2);




	}

	function query($sqlsentence){
		$this->queryresult = mysql_query($sqlsentence,$this->connection2);
	}

	function create_db ($name){
		@mysql_create_db($name,$this->connection2);
	}

	function delete_db($name){
		mysql_drop_db($name,$this->connection2);
	}

	function select_db($name){
		mysql_select_db($name,$this->connection2);
	}

	function one_result($rownumber,$fieldnumber){
		@$this->finalresult = mysql_result($this->queryresult,$rownumber,$fieldnumber);
	}

	function all_results_into_array(){
		@$this->arrayfinalresult = mysql_fetch_array($this->queryresult);
	}

	function field_name($columnnumber){
		$this->finalresult = mysql_field_name($this->queryresult,$columnnumber);
	}

	function field_type($columnnumber){
		$this->finalresult=mysql_field_type($this->queryresult,$columnnumber);
	}

	function error(){
		$this->error=mysql_error($this->connection2);
	}

	function numrows(){
		$this->finalresult=mysql_num_rows($this->queryresult);
	}

}

?>
Return current item: NAR contents manager