pdo-wrapper
pdo-wrapper copied to clipboard
Improved update Method with Flexible WHERE Conditions
The original update method only supported an array-based WHERE condition, which limited flexibility when handling more complex conditions (e.g., using OR, nested conditions, or raw SQL expressions). To address this limitation, I have modified the method to support custom WHERE clauses.
I have implemented two versions of the updated method, allowing you to choose the one that best fit for this project.
- Modify the original function
update('users', ['name' => 'John'], 'id = ? OR email = ?', [10, '[email protected]']);
- Add a new function
updateByWhere('users', ['name' => 'John'], 'id = ? OR email = ?', [10, '[email protected]']);