Jump to content

members online from database


fullyloaded

Recommended Posts

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";

?>
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

[!--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...
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.