2
$xoopsDB->query( $sql ) will only execute:
1. when the sql statement is a 'select' statement or
2. when the insert/update/delete statement is coming from a $_POST request.
This is for security, so that $_GET requests are only able to 'view' data, not perform updates on the database.
To make your code work you need to either call the script using a POST request, or force the update by using $xoopsDB->queryF( $sql ). It's your choice which to use.
If you want to convert a GET request to POST you can use the confirmation page. This page is submitted as a POST request, which then allows the sql statement to be executed.
e.g.
if ( isset( $_POST['ok'] ) ) {
// execute your sql
} else {
xoops_confirm( array( 'ok' => 1 ), 'index.php', CONFIRM_TEXT );
}
If you don't want user interaction then use queryF.