Comments (2)
Hi narasimha-kvl,
Thanks for using PDO_Class_Wrapper,
The problem is that you are using 'username' field twice in your query and this is the reason PDO Wrapper creating final query like this:
UPDATE `usertable` SET password = :s_password, acctype = :s_acctype, username = :s_username WHERE username = :s_username LIMIT 1;
The PDO Wrapper use namespace bind param to keep safe query's and in your query PDO Wrapper getting two same field and that's why your 'username' filed not updating or it's remains same as old.
While you executing raw query it's working but not with PDO Wrapper.
UPDATE usertable SET username = "test12", password = "81dc9bdb52d04dc20036dbd8313ed055", acctype = 0 WHERE username = "test" LIMIT 1;
The good practice is that always use primary key to update tables records. like below
$pObjDB->update('usertable', array('username' => $newuser, 'password' => $passwordMD5, 'acctype' => 0), array('id' => $uid))->affectedRows();
else you can user 'pdoQuery' method:
$pObjDB->pdoQuery("UPDATE usertable SET username = ?, password = ?, acctype = ? WHERE username = ? LIMIT 1;",array("test12","81dc9bdb52d04dc20036dbd8313ed055",'0',"test"))->showQuery()->affectedRows();
Sorry for inconvenience :( I will update this bug on next release. I am working on next release and it would be here soon and it would be perfect!! and more reliable :)
Cheers!!!! 👍
from pdo_class_wrapper.
Thank you for quick help. I had a special scenario for change in username and that table doesn't had a primary key
from pdo_class_wrapper.
Related Issues (17)
- wild cards? HOT 1
- Please make a PHP8 code review HOT 3
- [Feature request] Add time elapsed in showQuery
- [Question] Update incremental value HOT 3
- [Feature request] Add more description to debug problems
- [Bug] date format is wrong
- [Feature request] Add support for PDO::PARAM_LOB
- SQLSTATE[08004] [1040] Too many connections HOT 7
- Connect through unix_socket HOT 1
- PHP8 Compatibility
- Insert issue HOT 1
- Insert issue HOT 3
- how can you compare array against string function HOT 3
- SQL IN operator HOT 1
- how to write a delete query HOT 5
- Do you have the latest version for PHP7 ? 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_class_wrapper.