Comments (3)
Do you want to open a pull request? I'm without my laptop for a few days
from pdo-wrapper.
Hi,
Did you resolve this issue?
from pdo-wrapper.
Bit of an old issue, but updating the 'update' function should resolve this...
public function update($table, $data, $where)
{
//collect the values from data and where
$values = [];
//setup fields
$fieldDetails = null;
foreach ($data as $key => $value) {
$fieldDetails .= "$key = ?,";
$values[] = $value;
}
$fieldDetails = rtrim($fieldDetails, ',');
//setup where
$whereDetails = null;
$i = 0;
foreach ($where as $key => $value) {
$whereDetails .= $i == 0 ? "$key = ?" : " AND $key = ?";
$values[] = $value;
$i++;
}
$stmt = $this->run("UPDATE $table SET $fieldDetails WHERE $whereDetails", $values);
return $stmt->rowCount();
}
from pdo-wrapper.
Related Issues (14)
- Close/Free for Performance? HOT 2
- mulitiple delete HOT 1
- Supported backends? HOT 4
- Need to be able to specify port and charset from outside of class HOT 3
- How to use with JOIN in SQL? HOT 1
- update method not using Where id and subid method HOT 1
- not use IN operator
- Update method improved HOT 1
- Unclear how to implement SHOW TABLES query
- Missing attribute to get the rowCount value when using update HOT 1
- feature sugestion: count method HOT 3
- Where on select HOT 1
- Error on charset when using PostgreSQL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pdo-wrapper.