PDA

View Full Version : members information on main page. NEED HELP!


01-21-2001, 03:15 PM
If anyone knows a php script that can diaplay the number of registered members, the newest registered member and his/her profile linked to that , will be on my main page not the forum pages. Like the main page on http://www.FlashKit.com

If any one can help me, it would be a blessing!

PS: I tried to make my own from the top 10 post script idea but it bombed out :(

Mike

01-22-2001, 02:57 AM
I tried to do this: by modifying the top 10 post script I came up with this but it never worked. I will just trow out the wrong number.

<?
require("forum/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$myselect = "select * FROM user ";
$result = mysql_query($myselect);
echo "Registered Members ",$result;
?>

This is what I made so far as I am a novice at this stuff.
Right now it is way incorrect, I made 5 registered users and it say it has 2. If anyone can help I would love it!
Once agian I dont know jack about hack, I am learning!

01-22-2001, 03:11 AM
<?php
require("forum/admin/config.php");
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$myselect = 'SELECT COUNT(*) AS count FROM user';
$result = mysql_fetch_array(mysql_query($myselect));
echo "Registered Members ".$result['count'];
?>

01-22-2001, 04:26 AM
Thanks Ed! I was so close but so wrong. I think I can wing the rest of the code. I will pu in my code when I finish it all up. So every one can see and use it.

Once again thanks and now I can sleep :)

01-25-2001, 04:36 PM
To make the code a bit more optimized change this line:

$myselect = 'SELECT COUNT(*) AS count FROM user';


To

$myselect = 'SELECT COUNT(userid) AS count FROM user';


No need to pull all of the fields from the user table.

01-25-2001, 04:51 PM
Actually, a COUNT(*) is faster because it just reads the number of rows in a table. COUNT(userid) does a full table scan looking for non-null components only.

01-26-2001, 12:49 AM
When I do that, all I get is;

http://www.soapedup.f2s.com/testing.php

What's wrong?! I just put in the .php code you told me, and I get that... Is there anything I need to edit?

01-26-2001, 01:12 AM
The only thing on in my .php document is;

<?php
require("http://www.soapedup.f2s.com/bbs/admin/config.php")include_path='.:/usr/local/lib/php;
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$myselect = 'SELECT COUNT(*) AS count FROM user';
$result = mysql_fetch_array(mysql_query($myselect));
echo "Registered Members ".$result['count'];
?>

..and nothing more... do I need to edit something? What? I have V Bulletin 1.14..-

01-26-2001, 01:16 AM
Originally posted by badmeetsevil-
The only thing on in my .php document is;

<?php
require("http://www.soapedup.f2s.com/bbs/admin/config.php")include_path='.:/usr/local/lib/php;
$db=mysql_connect($servername,$dbusername,$dbpassw ord);
mysql_select_db($dbname);
$myselect = 'SELECT COUNT(*) AS count FROM user';
$result = mysql_fetch_array(mysql_query($myselect));
echo "Registered Members ".$result['count'];
?>

..and nothing more... do I need to edit something? What? I have V Bulletin 1.14..-



Should be:
require("http://www.soapedup.f2s.com/bbs/admin/config.php");
include_path="./usr/local/lib/php";

01-26-2001, 10:25 PM
I changed that.. yet get another phrase error on line 3.. whats wrong?

01-26-2001, 11:17 PM
Wayne--
: is the directory delimiter in php.ini for *nix. ; is used for Win32.

Don't require your config.php accross the web- just put the full path to it (/full/path/to/config.php)

01-27-2001, 12:02 PM
Every thing is good on my end. I am working on some other information I want extracted from data. I want to know also how to get the latest username created, I think it's done but getting the latest time/date but I seem not able to get the latest one it's always the first one ever made.

I'll figuar it out one day, but If anyone got that down packed let me know :)

mike

01-27-2001, 05:42 PM
Hmph... It still seems to not work.. I changed everything, but still get an error.

http://www.soapedup.f2s.com/testing.php

01-29-2001, 12:38 PM
Ed,

With that in mind would this code:

$pmcounta = $DB_site->query_first("SELECT COUNT(msgid) AS msgid FROM privatercvd WHERE toid=$bbuserid");
$pmcount = $pmcounta[msgid];
$newpmcounta = $DB_site->query_first("SELECT COUNT(msgid) AS msgid FROM privatercvd WHERE toid=$bbuserid AND UNIX_TIMESTAMP(datetime)>$bblastvisit");


be better off like this:

$pmcounta = $DB_site->query_first("SELECT COUNT(*) AS msgid FROM privatercvd WHERE toid=$bbuserid");
$pmcount = $pmcounta[msgid];
$newpmcounta = $DB_site->query_first("SELECT COUNT(*) AS msgid FROM privatercvd WHERE toid=$bbuserid AND UNIX_TIMESTAMP(datetime)>$bblastvisit");

01-29-2001, 05:10 PM
James--
Yes. vB2 has all those kinds of optimizations and more.