Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
PHP-MySQLi-Database-Class
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
PHP-MySQLi-Database-Class
Commits
71fecfda
Commit
71fecfda
authored
May 19, 2014
by
screeper
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add prefix feature
Set a prefix with the connection...
parent
0a03d83b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
5 deletions
+12
-5
MysqliDb.php
MysqliDb.php
+12
-5
No files found.
MysqliDb.php
View file @
71fecfda
...
...
@@ -19,6 +19,12 @@ class MysqliDb
* @var MysqliDb
*/
protected
static
$_instance
;
/**
* Table prefix
*
* @var string
*/
protected
$_prefix
;
/**
* MySQLi instance
*
...
...
@@ -94,12 +100,13 @@ class MysqliDb
* @param string $db
* @param int $port
*/
public
function
__construct
(
$host
,
$username
,
$password
,
$db
,
$port
=
NULL
)
public
function
__construct
(
$host
,
$username
,
$password
,
$db
,
$p
refix
=
''
,
$p
ort
=
NULL
)
{
$this
->
host
=
$host
;
$this
->
username
=
$username
;
$this
->
password
=
$password
;
$this
->
db
=
$db
;
$this
->
prefix
=
$prefix
;
if
(
$port
==
NULL
)
$this
->
port
=
ini_get
(
'mysqli.default_port'
);
else
...
...
@@ -214,7 +221,7 @@ class MysqliDb
$columns
=
'*'
;
$column
=
is_array
(
$columns
)
?
implode
(
', '
,
$columns
)
:
$columns
;
$this
->
_query
=
"SELECT
$column
FROM
$tableName
"
;
$this
->
_query
=
"SELECT
$column
FROM
$t
his->_prefix$t
ableName
"
;
$stmt
=
$this
->
_buildQuery
(
$numRows
);
$stmt
->
execute
();
$this
->
_stmtError
=
$stmt
->
error
;
...
...
@@ -248,7 +255,7 @@ class MysqliDb
*/
public
function
insert
(
$tableName
,
$insertData
)
{
$this
->
_query
=
"INSERT into
$tableName
"
;
$this
->
_query
=
"INSERT into
$t
his->_prefix$t
ableName
"
;
$stmt
=
$this
->
_buildQuery
(
null
,
$insertData
);
$stmt
->
execute
();
$this
->
_stmtError
=
$stmt
->
error
;
...
...
@@ -267,7 +274,7 @@ class MysqliDb
*/
public
function
update
(
$tableName
,
$tableData
)
{
$this
->
_query
=
"UPDATE
$tableName
SET "
;
$this
->
_query
=
"UPDATE
$t
his->_prefix$t
ableName
SET "
;
$stmt
=
$this
->
_buildQuery
(
null
,
$tableData
);
$stmt
->
execute
();
...
...
@@ -287,7 +294,7 @@ class MysqliDb
*/
public
function
delete
(
$tableName
,
$numRows
=
null
)
{
$this
->
_query
=
"DELETE FROM
$tableName
"
;
$this
->
_query
=
"DELETE FROM
$t
his->_prefix$t
ableName
"
;
$stmt
=
$this
->
_buildQuery
(
$numRows
);
$stmt
->
execute
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment