fullyloaded Posted March 26, 2006 Share Posted March 26, 2006 hi can anyone help me please? here is the code from my database witch is the first(1)what im trying to do is get this code to read how many members have signed up to my site i know how to do it one way witch is number(2)and it works fine but the problem is my site is html and php witch is number (1)anyone no how to take number (1) and make it do the same as number (2)? thanks.. (1) $dbu->query("SELECT COUNT(*) AS maxrows FROM p_message WHERE member_id='".$vars['member_id']."' AND `read`='0'"); $dbu->move_next(); $ft->assign("PM_NO", $dbu->f('maxrows') ); (2) <?php $holder = mysql_connect("localhost", "name here", "password here"); mysql_select_db("name here", $holder); $result = mysql_query("SELECT * FROM member", $holder); $members = mysql_num_rows($result); echo "$members members to date! \n"; ?> Quote Link to comment Share on other sites More sharing options...
mb81 Posted March 26, 2006 Share Posted March 26, 2006 What error message are you gettitng or what is happening that makes you think it is not working.[code]$dbu->query("SELECT COUNT(*) AS maxrows FROM p_message WHERE member_id='".$vars['member_id']."' AND `read`='0'"); [/code]There is no group BY in your SQL, so that is probably causing an error, but there is also no point in doing the count(*) function if you are only searching for one member, try using this SQL:[code]"SELECT member_id FROM p_message WHERE member_id='".$vars['member_id']."' AND 'read'='0'"[/code]Then, use the mysql_num_rows() function to count them up. Quote Link to comment Share on other sites More sharing options...
fullyloaded Posted March 26, 2006 Author Share Posted March 26, 2006 [!--quoteo(post=358697:date=Mar 26 2006, 06:31 PM:name=mb81)--][div class=\'quotetop\']QUOTE(mb81 @ Mar 26 2006, 06:31 PM) [snapback]358697[/snapback][/div][div class=\'quotemain\'][!--quotec--]What error message are you gettitng or what is happening that makes you think it is not working.[/quote]number 1 and number 2 works fine but im trying to do is get number 2 changed into number 1 coding because number 1 is the code from my site but number2 is code i just came up with in a new php file im just trying to get how many members in total signed up to my site hope you know what im talking about lol thanks... 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.