I’m currently building a phonegap app.
One page contains a form that allows the signed in user to update basic settings. On this page I have a “update” button that calls a JS function which updates the DB with the changed settings. However, I seem to be unable to get even the most basic update working.
Heres a (much simplified) example.
function updateSettings(tx) {
tx.executeSql('UPDATE USERS SET (username) VALUES ("edit") WHERE id = 1');
}
db.transaction(updateSettings, errorCB);
Running this (and pretty much every other update ive tried) gives me this error:
Error processing SQL: could not prepare statement (1 near "(": syntax error)
The slightly more complicated query I was originally trying to run was this:
tx.executeSql('UPDATE USERS SET (username, password, userId, defaultHandler, autoSync, updateCT, updateHistorical, updateFavorite, signedIn) VALUES ("'+ username +'", "'+ password +'", "plUserId", "Default Handle", "'+ sync +'", "' + updateCaseTypes + '", "' + updateHistoricalCases + '", "' + updateFavoriteCases +'", "1") WHERE id = 1');
Could anyone point me in the right direction?
Many thanks in advance
That is not valid SQL. See the SQLite documentation on
UPDATE.