ok

Mini Shell

Direktori : /home/institutonamaste/www/class/
Upload File :
Current File : /home/institutonamaste/www/class/DB_database.php

<?php 
	function DBExecute($query, $verid = FALSE)
	{
		$conn 	= DBConnect();
		$result = mysqli_query($conn, $query) or die(/*"Ocorreu um erro inesperado em nosso site, tente novamente ou nos comunique o problema."*/mysqli_error($conn));
		
		if($verid)
			$result = mysqli_insert_id($conn);	

		DBClose($conn);
		return $result;
	}
	
	function DBRead($table, $params = NULL, $fields = '*')
	{
		$table 	= DB_PREFIX.'_'.$table;
		$params = ($params) ? " {$params}" : NULL;
		
		$query 	= "SELECT {$fields} FROM {$table}{$params}";
		$result = DBExecute($query);
		
		return $result;
		
	}
	
	function DBInsert($table, array $data, $verid = FALSE)
	{
		$table 	= DB_PREFIX.'_'.$table;
		$data 	= DBEscape($data);
		
		$coluna = implode(', ', array_keys($data));
		$valor	= "'".implode("', '", $data)."'";
		
		$query	= "INSERT INTO {$table} ( {$coluna} ) VALUES ( {$valor} )";
		
		return DBExecute($query, $verid);	
	}
?>

Zerion Mini Shell 1.0