Looks like you are doing JOINs the (very)hard way.
If I'm correct, all you're doing is selecting the unique users from uid_trans, then finding the name for each user from 'user', and then printing adding all the credit_value for that user.
Try this something like this from the MySQL commandline:
SELECT user.uid,
user.name,
SUM(uid_trans.credit_value)
FROM user, uid_trans
WHERE user.uid = uid_trans.uid
GROUP BY user.name
ORDER BY user.name ASC
I suggest you open the MYSQL manual pages and just flick through the pages, look at the command and what they basically do. Just to give you an idea of what SQL can do.
A forum, a FAQ, what else do you need?