Skip to content
Advertisement

How to follow user id to get sum of MySQL column in PHP?

I have a column in a table that I want to follow “user id = 3” to get sum of MySQL column in PHP. but it’s not working. Below is my code:

The output show me like below the picuture and no show total sum up value :

enter image description here

Below is my database information, actually I want to select user_id = 3 and to total up “total_amount”: enter image description here

Advertisement

Answer

Lets add alias to your column and get the column value based on index.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement