pdo-wrapper icon indicating copy to clipboard operation
pdo-wrapper copied to clipboard

Improved update Method with Flexible WHERE Conditions

Open solidarity-forever opened this issue 10 months ago • 0 comments

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.

  1. Modify the original function
update('users', ['name' => 'John'], 'id = ? OR email = ?', [10, '[email protected]']);
  1. Add a new function
updateByWhere('users', ['name' => 'John'], 'id = ? OR email = ?', [10, '[email protected]']);

solidarity-forever avatar Mar 18 '25 06:03 solidarity-forever