SCHLIX\cmsDatabase

Inherited from MySQLi

Protected Attributes

protected $is_initalized= false
protected $server 
protected $username 
protected $password 
protected $db 
protected $last_query 
protected $last_query_result 

Public Attributes

public _debug_sql_= 0

Protected Methods

protected arrayfetch_result_as_array()
Fetch the result of the last query and return it as an associative array Do not call this method directly

Public Methods

public __construct($server, $db, $username, $password)
public q()
Returns the query builder
public reselectDatabase()
public stringescapeString(string $s)
Escape string, without the quote
public typesanitizeString(string $s, bool $add_quote=true)
Escape string and add a quote by default. Set to FALSE so it won't add a quote
public getTableColumns($tablename)
public booleantableColumnExists(string $tablename, string $tablecolumn)
Returns true if a table has the specified column
public booleantableExists(string $tablename)
Returns true if table exists. Use runtime (this script only
public mixedquery(string $sql, array $data=NULL)
Executes an SQL Query. If $data is specified, the variables will be bound to the specified query and escaped properly with mysqli_real_escape_string. If you are using a paremterized query, the default syntax is named statements like the PDO one, not the MySQLi one. e.g. INTO tbl_example (id,value) VALUES (:id,:value) Although it's doable, DO NOT mix sql with the value, e.g. if you want to do a non-paramterized statement, then don't mix it with the one that uses paramaterized statment This is wrong: INTO tbl_example (id,value) VALUES (:id,'Sanitized string') Although it will work it can have an unexpected outcome if the string contains variable name. e.g. ' .... String string string :example ....text'
public arraygetTimedCachedQueryResultArray(int $hours, int $minutes, int $seconds, string $sql, array $data=NULL)
Returns a cached query result as an associative array (data row collection)
public array Associative ArraygetCachedQueryResultArray(string $sql, array $data=NULL)
Returns a cached query result as an associative array (data row collection)
public array Associative ArraygetCachedQueryResultSingleRow(string $sql, array $data=NULL)
Returns a single row from cache
public arraygetQueryResultSingleRow(string $sql, array $data=NULL)
Get the first result of a query in (a single data row)
public arraygetQueryResultArray(string $sql, array $data=NULL)
Get SQL query result as an associative array (data row collections)
public intgetLastInsertID()
Returns the last insert ID
public getLastQueryResult()
public simpleInsertInto($table_name, $array)
public simpleUpdate($table_name, $array, $where_key, $where_value)
public searchAndReplace(string $table_name, string $field_name, string $search, string $replace, string $where_condition=NULL)
Performs search and replace
public getAllRecordsFromTable($table_name, $data_fields, $extra_criteria, $fields=' *', $start, $end, $sortby='', $sortdirection='ASC', $from_cache=false)
public generateSQLSelectParameters($tablename, $fields=' *', $extra_criteria='', $start, $end, $sortby='', $sortdirection='ASC', $force_limit=false)
public generateSelectSQLStatement($tablename, $fields=' *', $extra_criteria='', $start, $end, $sortby='', $sortdirection='ASC', $add_where_clause=true, $force_limit=false)
public __destruct()