PHP Class App\services\Database

Afficher le fichier Open project: printempw/blessing-skin-server Class Usage Examples

Méthodes publiques

Méthode Description
__construct ( array $config = null ) Construct with a config array.
__destruct ( )
delete ( $condition = null, $table = null )
fetchArray ( $sql )
getNumRows ( $key, $value, $table = null )
getRecordNum ( $table = null )
has ( $key, $value, $table = null )
hasTable ( $tableName )
insert ( $data, $table = null )
prepareConnection ( array $config = null ) : mysqli Try to connect to the database with given config.
query ( $sql )
select ( string $key, string $value, array $condition = null, string $table = null, boolean $dont_fetch_array = false ) : array | resources Select records from table
table ( $tableName, $no_prefix = false )
update ( $key, $value, $condition = null, $table = null )

Private Methods

Méthode Description
where ( array $condition ) : string Generate where statement

Method Details

__construct() public méthode

Construct with a config array.
public __construct ( array $config = null )
$config array

__destruct() public méthode

public __destruct ( )

delete() public méthode

public delete ( $condition = null, $table = null )

fetchArray() public méthode

public fetchArray ( $sql )

getNumRows() public méthode

public getNumRows ( $key, $value, $table = null )

getRecordNum() public méthode

public getRecordNum ( $table = null )

has() public méthode

public has ( $key, $value, $table = null )

hasTable() public méthode

public hasTable ( $tableName )

insert() public méthode

public insert ( $data, $table = null )

prepareConnection() public static méthode

Try to connect to the database with given config.
public static prepareConnection ( array $config = null ) : mysqli
$config array
Résultat mysqli

query() public méthode

public query ( $sql )

select() public méthode

Select records from table
public select ( string $key, string $value, array $condition = null, string $table = null, boolean $dont_fetch_array = false ) : array | resources
$key string
$value string
$condition array See function `where`
$table string Which table to operate
$dont_fetch_array boolean Return resources if true
Résultat array | resources

table() public méthode

public table ( $tableName, $no_prefix = false )

update() public méthode

public update ( $key, $value, $condition = null, $table = null )