Database updates can be made manually with the SQL() function, but this can be tedious and error-prone. The SQL function SQLX_Update() is a much easier way to do updates.
<?php
class x6example extends androX6 {
function x6main() {
$row = array(
skey=>1234
,'headline'=>"Now Available: SQLX_Update"
);
SQLX_Update('articles',$row);
}
}
The SQLX_Update function automatically escapes all values, so you do not need to worry about protecting against SQL Injection.
The SQLX_Update function knows about row security and column security. You can name the base table in the function and not worry about which view needs to be used.
The SQLX_Update function quietly discards elements from the array that cannot be directly assigned by the user, such as FETCH values or values calculated with a CHAIN.
The SQLX_Update function quietly discards elements from the array that do not match an actual column in the destination table.
The SQLX_Update function does not trim values, if you provide a value that is too long for a column, it will throw out an error.
SQLX_Update requires either an skey value or all values of the primary key. If neither of these is provided, it will not perform and update.