DB - Updating data

<input type="number" id="account" placeholder="account number..."> <input type="number" id="credit" placeholder="credit value..."> <button id="btn">Update credit</button> <output id="out"></output> <script src="src/db.js"></script> <script> btn.onclick = _=> DB.query("UPDATE accounts SET credit=? WHERE rowid=?", [credit.value, account.value]) .then(n => out.innerHTML = n ? "Credit updated" : "No such account"); </script>

DB.query syntax

int DB.query(string query, [array params])

This method can also have params, just like DB.select. The returned value is the number of affected rows (meaningful for UPDATE and DELETE).