pdox
pdox copied to clipboard
update
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
Hi @istoGer , This is a good suggestion. I will prepare an enhancement for this as soon as possible. Thanks!
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