Well apparently you have another error in your mysql database update query. Find every instance of:
PHP Code:
"owner" => '{$user}',
And replace by:
PHP Code:
"owner" => $user,
If it still wont fix your problem, please post a screenshot and I will see what is causing the problem exactly. Also I am a bit confused at where exactly the error is. Does the script insert a row in database under the user '$user', or that it is just $user being displayed on the screen while nothing is abnormal from database?