\AppDatabase

A Database class

Perform UPDATE and SELECT operations

Summary

Methods
Properties
Constants
__construct()
getRowCount()
getRows()
update()
query()
$rows
$rowCount
No constants found
initQuery()
bind()
$db
$stmt
N/A
No private methods found
No private properties found
N/A

Properties

$rows

$rows : array

Store SQL query results

Type

array

$rowCount

$rowCount : integer

Store count of SQL query results

Type

integer

$db

$db : \PDO

Store database connection

Type

\PDO — object

$stmt

$stmt : \PDO

Store SQL query

Type

\PDO — object

Methods

__construct()

__construct() 

Establish database connection Make SQL query results empty

getRowCount()

getRowCount() : integer

Get SQL query results row count

Returns

integer —

Count of SQL query results

getRows()

getRows() : array

Get SQL query result

Returns

array —

SQL query result

update()

update(string  $table, array  $data, integer  $id) : boolean

Update row of a table

Parameters

string $table

Table name

array $data

Data to be updated

integer $id

Id of the row

Returns

boolean —

Update successfully executed or not

query()

query(string  $table, array  $data, integer|null  $limit = null) : boolean

Query record in table

Parameters

string $table

Table name

array $data

Data to be queried

integer|null $limit

Limit query results

Returns

boolean —

Query successfully executed or not

initQuery()

initQuery() 

Initialize query result Set $result to empty array

bind()

bind(array  $data) 

Bind data value to parameter

Parameters

array $data

Data for SQL query