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
f690648b
Commit
f690648b
authored
Oct 12, 2010
by
Jeffrey Way
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed update and where method glitches
parent
809dfa54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
32 deletions
+32
-32
MysqlDb.php
MysqlDb.php
+32
-32
No files found.
MysqlDb.php
View file @
f690648b
...
...
@@ -43,7 +43,7 @@ class MysqlDB {
$stmt
->
execute
();
$results
=
$this
->
_dynamicBindResults
(
$stmt
);
return
$results
;
}
...
...
@@ -118,21 +118,21 @@ class MysqlDB {
protected
function
_determineType
(
$item
)
{
switch
(
gettype
(
$item
))
{
case
'string'
:
return
's'
;
break
;
case
'string'
:
return
's'
;
break
;
case
'integer'
:
return
'i'
;
break
;
case
'integer'
:
return
'i'
;
break
;
case
'blob'
:
return
'b'
;
break
;
case
'blob'
:
return
'b'
;
break
;
case
'double'
:
return
'd'
;
break
;
case
'double'
:
return
'd'
;
break
;
}
}
...
...
@@ -162,23 +162,23 @@ class MysqlDB {
// and create the SQL query, accordingly.
if
(
$hasTableData
)
{
$i
=
1
;
$pos
=
strpos
(
$this
->
_query
,
'UPDATE'
);
$pos
=
strpos
(
$this
->
_query
,
'UPDATE'
);
if
(
$pos
!==
false
)
{
$this
->
_crudType
=
'update'
;
foreach
(
$tableData
as
$prop
=>
$value
)
{
// determines what data type the item is, for binding purposes.
$this
->
_paramTypeList
.=
$this
->
_determineType
(
$value
);
// prepares the reset of the SQL query.
if
(
$i
===
count
(
$tableData
))
{
$this
->
_query
.=
$prop
.
" = ? WHERE
$where_prop
= '
$where_value
'"
;
}
else
{
$this
->
_query
.=
$prop
.
' = ?, '
;
}
$i
++
;
}
}
foreach
(
$tableData
as
$prop
=>
$value
)
{
// determines what data type the item is, for binding purposes.
$this
->
_paramTypeList
.=
$this
->
_determineType
(
$value
);
// prepares the reset of the SQL query.
if
(
$i
===
count
(
$tableData
))
{
$this
->
_query
.=
$prop
.
" = ? WHERE
$where_prop
= '
$where_value
'"
;
}
else
{
$this
->
_query
.=
$prop
.
' = ?, '
;
}
$i
++
;
}
}
}
else
{
// no table data was passed. Might be SELECT statement.
$this
->
_paramTypeList
=
$this
->
_determineType
(
$where_value
);
...
...
@@ -265,9 +265,9 @@ class MysqlDB {
/**
* Method attempts to prepare the SQL query
* and throws an error if there was a problem.
*/
* Method attempts to prepare the SQL query
* and throws an error if there was a problem.
*/
protected
function
_prepareQuery
()
{
if
(
!
$stmt
=
$this
->
_mysql
->
prepare
(
$this
->
_query
))
{
...
...
@@ -279,7 +279,7 @@ class MysqlDB {
public
function
__destruct
()
{
$this
->
_mysql
->
close
();
$this
->
_mysql
->
close
();
}
}
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