php question
Ok, I have no clue if or how this would be done, because I'm less than a beginner when it comes to php and such. My [ community forums ] has a place at the bottom that tells how many registered members we have, as I'm sure all forums have.
On my [ website ] I have a place on the left section there where I have a php counter ( which I'm proud as hell that I got working ! ) and right below that I post the number of members in the community. At the moment I just manually change that number. How - or even can I - get that members number from the forum posted on my website so that it will automatically update for me? Any ideas? I know there are some smart php / code people here to help me out. |
I only know of 2 ways: 1: you see if in the forum database there is a field that has the count, and just pull it from there, or 2: you count all the users in your forum users table and display that number.
You using phpnuke or some other cms system? if so, there may be a block that already exists for your forum that may do this automatically |
No, not phpNuke. Just a plain old website.
I know with my php counter I had to upload more than just the php script. I guessing I would have to do something like that in this situation? Or is it as simple as finding that code and pasting it into the webiste? |
yes, with probably some formating code to get it to display where you want it to. which forums do you use?
IcI |
Would be easy to tell you if I knew the table structure of ipb.. but I dont and it dosen't look like it's free anymore so i cant check :confused:
your query would look something like <? $connect=mysql_connect("localhost","mysql_username ","mysql_password"); $db=mysql_select_db("forum_database"); $query=mysql_query("SELECT user_id FROM users_table"); $total_users=mysql_num_rows($query); Echo("We have a total of ".intval($total_users)." users in our community."); mysql_free_result($query); mysql_close($connect); ?> |
Or just include global.php and grab the user count, same as on the forum :) But counting rows would be alot less work ;)
|
if your having trouble i'll help set that up for free :) contact me @ mcdonaldcoding@hotmail.com
|
Awesome, I shall e-mail you from my home account in the morning. I'm php-retarded.
|
All times are GMT -5. The time now is 04:26 AM. |
Powered by vBulletin®