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
5eba6215
Commit
5eba6215
authored
Oct 23, 2010
by
Josh Campbell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added Features
parent
8f36a33f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
192 additions
and
107 deletions
+192
-107
.gitignore
.gitignore
+5
-0
MysqlDb.php
MysqlDb.php
+149
-83
changelog.md
changelog.md
+12
-0
index.php
index.php
+12
-11
readme.md
readme.md
+14
-13
No files found.
.gitignore
0 → 100644
View file @
5eba6215
#Mac OS X files
.DS_Store
#Vim leave-behinds
*.swp
\ No newline at end of file
MysqlDb.php
View file @
5eba6215
This diff is collapsed.
Click to expand it.
changelog.md
0 → 100644
View file @
5eba6215
<h3>
Change Log
</h3>
<p>
Branch off master
</p>
<ul>
<li>
Changed package name to MySqliDb. This is a MySQLi wrapper.
</li>
<li>
Added support for multiple dynamicly bound where conditions.
</li>
<li>
Added state resetting after each query exicution to allow multiple calls to the same connection instance.
</li>
<li>
Added the ability to staticly retreive the current instance.
</li>
<li>
Added numRows support to the query method.
</li>
<li>
The triggered error in _prepareQuery() now also displays the SQL statment and the mysqli error message.
</li>
</ul>
\ No newline at end of file
index.php
View file @
5eba6215
<?php
require_once
(
'MysqlDb.php'
);
require_once
(
'Mysql
i
Db.php'
);
$Db
=
new
MysqlDb
(
'localhost'
,
'root'
,
'root'
,
'db'
);
$insertData
=
array
(
'title'
=>
'Inserted title'
,
'body'
=>
'Inserted body'
);
$results
=
$Db
->
insert
(
'posts'
,
$insertData
);
print_r
(
$results
);
$db
=
new
MysqliDb
(
'localhost'
,
'root'
,
'root'
,
'db'
);
?>
<!DOCTYPE html>
...
...
@@ -21,6 +12,16 @@ print_r($results);
<title>
untitled
</title>
</head>
<body>
<?php
$insertData
=
array
(
'title'
=>
'Inserted title'
,
'body'
=>
'Inserted body'
);
$results
=
$db
->
insert
(
'posts'
,
$insertData
);
print_r
(
$results
);
?>
</body>
</html>
\ No newline at end of file
readme.md
View file @
5eba6215
To utilize this class, first import Mysql
Db
.php into your project, and require it.
To utilize this class, first import Mysql
dbi
.php into your project, and require it.
<pre>
<code>
require_once('Mysql
D
b.php');
require_once('Mysql
id
b.php');
</code>
</pre>
...
...
@@ -10,7 +10,7 @@ After that, create a new instance of the class.
<pre>
<code>
$
Db = new MysqlD
b('host', 'username', 'password', 'databaseName');
$
db = new Mysqlid
b('host', 'username', 'password', 'databaseName');
</code>
</pre>
...
...
@@ -25,7 +25,7 @@ $insertData = array(
'body' => 'Inserted body'
);
if ( $
D
b->insert('posts', $insertData) ) echo 'success!';
if ( $
d
b->insert('posts', $insertData) ) echo 'success!';
</code>
</pre>
...
...
@@ -34,7 +34,7 @@ if ( $Db->insert('posts', $insertData) ) echo 'success!';
<pre>
<code>
$results = $
D
b->get('tableName', 'numberOfRows-optional');
$results = $
d
b->get('tableName', 'numberOfRows-optional');
print_r($results); // contains array of returned rows
</code>
</pre>
...
...
@@ -47,8 +47,8 @@ $updateData = array(
'fieldOne' => 'fieldValue',
'fieldTwo' => 'fieldValue'
);
$
D
b->where('id', int);
$results = $
D
b->update('tableName', $updateData);
$
d
b->where('id', int);
$results = $
d
b->update('tableName', $updateData);
</code>
</pre>
...
...
@@ -56,8 +56,8 @@ $results = $Db->update('tableName', $updateData);
<pre>
<code>
$
Db->where('id', integer
);
if ( $
D
b->delete('posts') ) echo 'successfully deleted';
$
db->where('id', int
);
if ( $
d
b->delete('posts') ) echo 'successfully deleted';
</code>
</pre>
...
...
@@ -65,17 +65,18 @@ if ( $Db->delete('posts') ) echo 'successfully deleted';
<pre>
<code>
$results = $
D
b->query('SELECT
*
from posts');
$results = $
d
b->query('SELECT
*
from posts');
print_r($results); // contains array of returned rows
</code>
</pre>
<h3>
Where Method
</h3>
<p>
This method allows you to specify the parameters of the query.
For now, it only accepts one key => value pair.
</p>
<p>
This method allows you to specify the parameters of the query.
</p>
<pre>
<code>
$Db->where('id', int);
$results = $Db->get('tableName');
$db->where('id', int);
$db->where('title', string);
$results = $db->get('tableName');
print_r($results); // contains array of returned rows
</code>
</pre>
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