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
2dab030a
Commit
2dab030a
authored
Aug 05, 2015
by
Alexander Butenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
documentation adjustments
parent
0763046c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
16 deletions
+10
-16
readme.md
readme.md
+10
-16
No files found.
readme.md
View file @
2dab030a
...
...
@@ -35,17 +35,12 @@ composer require joshcam/mysqli-database-class:dev-master
```
### Initialization
Simple initialization with utf8 charset by default:
Simple initialization with utf8 charset
set
by default:
```
php
$db
=
new
MysqliDb
(
'host'
,
'username'
,
'password'
,
'databaseName'
);
```
Or in case usage of the namespaces:
```
php
$db
=
new
\MysqliDb
(
'host'
,
'username'
,
'password'
,
'databaseName'
);
```
Advanced initialization
. If no charset should be set charset, set it to null
Advanced initialization
:
```
php
$db
=
new
MysqliDb
(
Array
(
'host'
=>
'host'
,
...
...
@@ -56,15 +51,16 @@ $db = new MysqliDb (Array (
'prefix'
=>
'my_'
,
'charset'
=>
'utf8'
));
```
prefix, port and charset params are optional.
table prefix, port and database charset params are optional.
If no charset should be set charset, set it to null
Reuse already connected mysqli
:
Also it is possible to reuse already connected mysqli object
:
```
php
$mysqli
=
new
mysqli
(
'host'
,
'username'
,
'password'
,
'databaseName'
);
$db
=
new
MysqliDb
(
$mysqli
);
```
I
ts also possible to set a table prefix vi
a separate call:
I
f no table prefix were set during object creation its possible to set it later with
a separate call:
```
php
$db
->
setPrefix
(
'my_'
);
```
...
...
@@ -75,6 +71,7 @@ If you need to get already created mysqliDb object from another class or functio
// db staying private here
$db
=
new
MysqliDb
(
'host'
,
'username'
,
'password'
,
'databaseName'
);
}
...
function
myfunc
()
{
// obtain db object created in init ()
$db
=
MysqliDb
::
getInstance
();
...
...
@@ -82,10 +79,8 @@ If you need to get already created mysqliDb object from another class or functio
}
```
Next, prepare your data, and call the necessary methods.
### Objects mapping
dbObject.php is an object mapping library built on top of mysqliDb to provide model
p
representation functionality.
dbObject.php is an object mapping library built on top of mysqliDb to provide model representation functionality.
See
<a
href=
'dbObject.md'
>
dbObject manual for more information
</a>
### Insert Query
...
...
@@ -156,9 +151,9 @@ if ($db->update ('users', $data))
else
echo
'update failed: '
.
$db
->
getLastError
();
```
### Select Query
After any select/get function calls amount or returned rows
is stored in $count variable
After any select/get function calls amount or returned rows is stored in $count variable
```
php
$users
=
$db
->
get
(
'users'
);
//contains an Array of all users
$users
=
$db
->
get
(
'users'
,
10
);
//contains an Array 10 users
...
...
@@ -234,7 +229,6 @@ $resutls = $db->rawQuery ($q, $params);
print_r
(
$results
);
// contains Array of returned rows
```
### Where Method
This method allows you to specify where parameters of the query.
...
...
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