src/Neuron/DB/Query.php
public static function select (
        $table,
        array $data = array(),
        array $where = array(),
        $order = array(),
        $limit = null
    ) {
		$query = 'SELECT ';
		$values = array ();

		if (count ($data) > 0) {
			foreach ($data as $v) {
				$query .= $v . ', ';
			}
			$query = substr ($query, 0, -2) . ' ';
		} else {
			$query .= '* ';
		}

		$query .= 'FROM ' . self::escapeTableName($table) . ' ';
		$query .= self::processWhere ($where, $values);

		// Order
		if (count ($order) > 0) {
			$query .= " ORDER BY ";
			foreach ($order as $v) {
				$query .= $v . ", ";
			}
			$query = substr ($query, 0, -2);
		}

		// Limit
		if ($limit) {
			$query .= " LIMIT " . $limit;
		}

		$query = new self($query);
		$query->bindValues($values);

		return $query;
	}
public static function select (
        $table,
        array $data = array(),
        array $where = array(),
        $order = array(),
        $limit = null
    ) {
		$query = 'SELECT ';
		$values = array ();

		if (count ($data) > 0) {
			foreach ($data as $v) {
				$query .= $v . ', ';
			}
			$query = substr ($query, 0, -2) . ' ';
		} else {
			$query .= '* ';
		}

		$query .= 'FROM ' . self::escapeTableName($table) . ' ';
		$query .= self::processWhere ($where, $values);

		// Order
		if (count ($order) > 0) {
			$query .= " ORDER BY ";
			foreach ($order as $v) {
				$query .= $v . ", ";
			}
			$query = substr ($query, 0, -2);
		}

		// Limit
		if ($limit) {
			$query .= " LIMIT " . $limit;
		}

		$query = new self($query);
		$query->bindValues($values);

		return $query;
	}
public static function select ( $ table , array $ data = array ( ) , array $ where = array ( ) , $ order = array ( ) , $ limit = null ) { $ query = 'SELECT ' ; $ values = array ( ) ; if ( count ( $ data ) > 0 ) { foreach ( $ data as $ v ) { $ query .= $ v . ', ' ; } $ query = substr ( $ query , 0 , - 2 ) . ' ' ; } else { $ query .= '* ' ; } $ query .= 'FROM ' . self :: escapeTableName ( $ table ) . ' ' ; $ query .= self :: processWhere ( $ where , $ values ) ; // Order if ( count ( $ order ) > 0 ) { $ query .= " ORDER BY " ; foreach ( $ order as $ v ) { $ query .= $ v . ", " ; } $ query = substr ( $ query , 0 , - 2 ) ; } // Limit if ( $ limit ) { $ query .= " LIMIT " . $ limit ; } $ query = new self ( $ query ) ; $ query -> bindValues ( $ values ) ; return $ query ; }
Select data from a message
@param $table
@param array $data : array of column names [ column1, column2 ]
@param array $where : a 2 dimensional array with syntax: { column_name : [ value, type, nullOnEmpty ]}
@param array $order
@param null $limit
@return Query
Select data from a message