nitation Posted July 16, 2008 Share Posted July 16, 2008 Hello people, I am working from my admin area. What am trying to do is to display user's information into a table. The information to be displayed is the user's total balance. Have a look at my code. This code is displaying the same information for all users. But i want it for a specific user only. <?php $sqluser2=mysql_query("select SUM(amount) AS Total FROM activity_table where status=1 ") ; if (!empty($sqluser2)){ $numuser=mysql_num_rows($sqluser2); while($row=mysql_fetch_array($sqluser2)){ $total=$row["Total"]; } } ?> How do i go about it. Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/115089-solved-error-displaying-records/ Share on other sites More sharing options...
wildteen88 Posted July 16, 2008 Share Posted July 16, 2008 append the username to the query, select SUM(amount) AS Total FROM activity_table where status=1 AND username='$username' Quote Link to comment https://forums.phpfreaks.com/topic/115089-solved-error-displaying-records/#findComment-591840 Share on other sites More sharing options...
nitation Posted July 16, 2008 Author Share Posted July 16, 2008 Thanks. I actually did that and it worked. regards Quote Link to comment https://forums.phpfreaks.com/topic/115089-solved-error-displaying-records/#findComment-591850 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.