Help with improvement of purchasing db processes

There are several db tables ( phpmyadmin ) working with the web php script that I’m using (but did not write).

The ‘user’ table has many fields, but pertaining to purchases it has these fields: ‘ip_address’ ‘username’ ‘wallet’ and ‘balance’.

The ‘paid_videos’ table has these fields: id_user, video_play_price, id_video, user_id_uploaded, video_title, earned_amount, time_date, short_id, session_key
video_id, time.

The ‘transact’ table has these fields: username, id_user, amount, balance, wallet, wal_bal, user_id_uploaded, earned_amount, time_date.

When a purchase is made a single row is populated in the ‘paid videos’ table and a single row is populated in the ‘transact’ table.

Additional info: when a purchase is made, an amount of 50% of the price (‘earned_amount’) appears in uploader’s (user_id_uploaded) ‘earned_amount’ field,
and gets added to the uploader’s ‘balance’ field.

And that amount is also reflected in ‘amount’ by a negative number, and reduces the purchaser’s ‘wallet’ or ‘balance’ by that same amount.
Also, wal_bal is total of wallet and balance.

I am looking for comments/suggestions for improvement. And/or besides improvement, what am I missing?

improvement of what? what are you measuring to determine that it has improved?

What steps have you taken to understand the script you are using? It doesn’t matter that you didn’t write the code. You are using it and you need to own it. That requires understanding it.

That’s a waste of space, in my opinion. If you have to, you can always derive that from the two other fields as part of your query, there’s no need to store it. (Presuming you refer to three columns in your description of the transact table). Storing it raises the spectre of the numbers not balancing, too.

What’s the difference between the “wallet” and the “balance”?

I have a sense that there are several fields that aren’t needed - for example storing the wallet and balance figures against each transaction. Likewise, it is really necessary for the transact table to store both the username and the id_user fields? Presuming again that these both refer to the same user. Wouldn’t it be more sensible to store the video id in that table somewhere, and that in turn would lead on to the uploader-id for that video?

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.