array.delete mutates the array, it doesn't return a new one. So:
PHP Code:
echo("Remove:" SPC temp.test[n]);
echo("From:" SPC temp.test);
temp.test.delete(n);
echo("New Array:" SPC temp.test);
will probably work. You might also find
array.remove(element) useful, which removes the first instance of an element in an array (meaning you don't have to iterate to find the index).
edit: on a related note, beware SQL injection in that query if you're not already escaping those values.