pdox icon indicating copy to clipboard operation
pdox copied to clipboard

update

Open istoGer opened this issue 6 years ago • 2 comments

Hi, is there a way to increment field via update-query like:

UPDATE myTable SET counter=counter+1 WHERE id=.$tId

another class did it this way: $data2 = ['anzahl' => $db->inc(-1)]; $db->table('myTable')->where('id', $tID)->update($data);

Thank you for support

istoGer avatar Nov 01 '19 01:11 istoGer

Hi @istoGer , This is a good suggestion. I will prepare an enhancement for this as soon as possible. Thanks!

izniburak avatar Nov 01 '19 05:11 izniburak

heres another nice feature :

'createdAt' => $db->now(),
// createdAt = NOW()
'expires' => $db->now('+1Y')
// expires = NOW() + interval 1 year
// Supported intervals [s]econd, [m]inute, [h]hour, [d]day, [M]onth, [Y]ear

its also from the class, I formerly used: https://github.com/tommyknocker/pdo-database-class

istoGer avatar Nov 04 '19 16:11 istoGer