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
b49872e1
Commit
b49872e1
authored
Nov 04, 2010
by
Josh Campbell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added "method chaining" to where method
parent
9ced1931
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
1 deletion
+11
-1
MysqliDb.php
MysqliDb.php
+4
-1
readme.md
readme.md
+7
-0
No files found.
MysqliDb.php
View file @
b49872e1
...
@@ -209,7 +209,9 @@ class MysqliDB {
...
@@ -209,7 +209,9 @@ class MysqliDB {
}
}
/**
/**
* This method allows you to specify multipl WHERE statements for SQL queries.
* This method allows you to specify multipl (method chaining optional) WHERE statements for SQL queries.
*
* @uses $MySqliDb->where('id', 7)->where('title', 'MyTitle');
*
*
* @param string $whereProp The name of the database field.
* @param string $whereProp The name of the database field.
* @param mixed $whereValue The value of the database field.
* @param mixed $whereValue The value of the database field.
...
@@ -217,6 +219,7 @@ class MysqliDB {
...
@@ -217,6 +219,7 @@ class MysqliDB {
public
function
where
(
$whereProp
,
$whereValue
)
public
function
where
(
$whereProp
,
$whereValue
)
{
{
$this
->
_where
[
$whereProp
]
=
$whereValue
;
$this
->
_where
[
$whereProp
]
=
$whereValue
;
return
$this
;
}
}
/**
/**
...
...
readme.md
View file @
b49872e1
...
@@ -100,5 +100,12 @@ $db->where('id', int);
...
@@ -100,5 +100,12 @@ $db->where('id', int);
$db->where('title', string);
$db->where('title', string);
$results = $db->get('tableName');
$results = $db->get('tableName');
print_r($results); // contains array of returned rows
print_r($results); // contains array of returned rows
Optionaly you can use method chaining to call where multiple times without calling referancing your object over an over:
$results = $db->where('id', 1)
->where('title', 'MyTitle')
->get('tableName');
print_r($results); // contains array of returned rows
</code>
</code>
</pre>
</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