Coder Social home page Coder Social logo

Comments (2)

noncent avatar noncent commented on August 11, 2024

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.

narasimha-kvl avatar narasimha-kvl commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.