All pastes #962602 Raw Edit

Unnamed

public php v1 · immutable
#962602 ·published 2008-03-29 22:04 UTC
rendered paste body
		function ProcessQuery($sql, $args)		{			if(!is_array($args))			{				$args = array($args);			}					$array = explode('?', $sql, sizeof($args));			if(sizeof($array) !== sizeof($args))			{				trigger_error("Error: $sql {$args[0]}", E_USER_WARNING);				return FALSE;			}					ksort($args);			$array = explode('?', $sql);			for($i = 0; $i < sizeof($args); ++$i)			{				$array .= "'".mysql_real_escape_string($args[$i])."'";			}			return implode('', $array);		}				function Query($sql, $args)		{			if($args) {				if(!is_array($args))				{					$args = array($args);				}							if(is_array($args))				{					$sql = $this->ProcessQuery($sql, $args);				}							if(($result = mysql_query($sql, $this->db_obj)) === FALSE)				{					trigger_error("There was an error processing your query:". $this->error);					return FALSE;				}							$data = array();				while($row = mysql_fetch_assoc($result))				{					$data[] = $row;o				}							return $data;			}		}