dazz_club Posted April 25, 2008 Share Posted April 25, 2008 Hi guys, I've got a database full of members, and what i would like to do for my admin page is to have a paragraph that informs me with updated info. What i want to know, or if someone can direct me to a good tut, is have a script that reads the amount of members i a from my table and simply have it displayed as a number. over all this is what i want to achieve and the number in bold are driving by a script the present the data as a number. --------------------- We have 14 enquiries, 2 new ones from Darren Azzopardi We have recieved 7 feedback comments Only 2 people have had problems loggin in ---------------------- kind regards Darren Quote Link to comment Share on other sites More sharing options...
947740 Posted April 25, 2008 Share Posted April 25, 2008 You can use mysql_num_rows($queryresult) to find the total number (of results) for every query you perform. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted April 25, 2008 Share Posted April 25, 2008 Total enquiries: SELECT COUNT(*) FROM `members` New enquiries: SELECT COUNT(*) FROM `members` WHERE `new`='yes' Number of comments: SELECT COUNT(*) FROM `feedback` WHERE `read`='no' Login problems: SELECT COUNT(*) FROM `members` WHERE `loginproblem`='yes' That's the basics but it depends on how you want to form the tables and how you're handling the data. Quote Link to comment Share on other sites More sharing options...
dazz_club Posted April 25, 2008 Author Share Posted April 25, 2008 Cheers dude, are you seriously 15? Quote Link to comment Share on other sites More sharing options...
dazz_club Posted April 25, 2008 Author Share Posted April 25, 2008 Cheers Yesideez I will work on these and get back to you guys with my progress. Quote Link to comment Share on other sites More sharing options...
947740 Posted April 25, 2008 Share Posted April 25, 2008 Yes, I am 15. Quote Link to comment Share on other sites More sharing options...
dazz_club Posted April 27, 2008 Author Share Posted April 27, 2008 Hi , I have set up a basic query, but i think i missing something as my result only retrieves 1 <?php $sql = "SELECT COUNT(*) FROM contacts"; $result = mysql_query($sql); echo mysql_num_rows($result); ?> kind regards Dazzclub Quote Link to comment Share on other sites More sharing options...
dazz_club Posted April 27, 2008 Author Share Posted April 27, 2008 hmm could be that i have selected the contacts row rather than the data in that field. could be..... *note to Dazzclub, look closer der brain. Quote Link to comment Share on other sites More sharing options...
dazz_club Posted April 27, 2008 Author Share Posted April 27, 2008 Done some tweaking to the code. Snow the code looks like this. <?php $sql = mysql_query("SELECT * FROM contacts"); $num_rows = mysql_num_rows($sql); echo "$num_rows Rows\n"; ?> and it works...well need to double check but its good for me Quote Link to comment 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.