Return to Snippet

Revision: 13218
at April 14, 2009 18:47 by xoxolatito


Initial Code
class bd extends conection
{

	public $table;
	public $fields;
	public $conection;
	
	public function sanitize($param) {
	
		return htmlspecialchars($param);
	
	}
	
	public function select($fields, $table, $where = '') {
		
		parent::conexion();
		$where = ($where == '') ? '' : ' WHERE ' . $where;
		$sql = "SELECT " . implode(',', $fields) . " FROM " . bd::sanitize($table) . $where;
		$query = mysql_query($sql);
		$select_output = array();
		while ($objetos = mysql_fetch_object($query)) {
			
			for ($i = 0; $i < sizeof($fields); $i++) {
				$select_output[] = $objetos->$fields[$i];
			}
		
		}
		
		return $select_output;
	}

}

Initial URL
none

Initial Description
rammstein plz another disc

Initial Title
Class select from database

Initial Tags

                                

Initial Language
PHP