Not based on your problem, but when using client_print, try using id in the first arg. Cause, you can't be sure that the user at index 1 is always the person using the command/function.
Now, your problem. You are storing the db result to the variable named res. Why are you using Result in the params for dbi_nextrow/dbi_result?
I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).