- elseif(! $r) { // the Boolean value for count($r) should be equivalent to the Boolean value of $r
- q("INSERT INTO locks ( name, locked ) VALUES ( '%s', 1 )",
- dbesc($fn_name)
+ elseif (! dbm::is_result($r)) {
+ /// @TODO the Boolean value for count($r) should be equivalent to the Boolean value of $r
+ q("INSERT INTO `locks` (`name`, `created`, `locked`) VALUES ('%s', '%s', 1)",
+ dbesc($fn_name),
+ dbesc(datetime_convert())