...
Section | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
...
Code Block | ||||
---|---|---|---|---|
| ||||
var record = { id: counter, firstname: fname, lastname: lname } pjs.query("INSERT INTO table SET ?", record); |
Add a Record
Code Block | ||||
---|---|---|---|---|
| ||||
// Load various types of data values into a table with four columns.
var version = "12345";
var record = {};
record.OneField = version; // variable
record.TwoField = data[1].__SOMEFIELD; // object property
record.RedField = "Suspended"; // literal
record.BlueField = cvtDate (data[1].DUEDATE); // function call
pjs.query ("INSERT INTO table SET ?", record) |
Update a Record
Code Block | ||||
---|---|---|---|---|
| ||||
var fieldsToUpdate = {}; fieldsToUpdate.firstname = fname; fieldsToUpdate.lastname = lname; pjs.query("UPDATE table SET ? WHERE id = ?", [ fieldsToUpdate, currentId ]); |
...