What's in $user_info ? if it contains user name and user email you can use it without doing anything else.
I cannot see anything wrong without the array debug output except for the reliance of dblastid in the last query. We have also mentioned before that lastid is unreliable if server lags.