Count Male And Female Online

Started on the old forum in July 2008 · view the original in the archive · old links redirect here

35 replies · 2,198 views · started 18 years ago · 1 min read

TL;DR · summary of 35 replies
  • - The issue was about counting Male and Female users online in an ONLINE MENU.
  • - The code approach involved using JOIN to combine ibwf_online and ibwf_users tables for accurate counts of male and female users.
  • - A solution was provided by Guest, suggesting a modification to the index.php file for better handling of page jumpers.

Written automatically from the replies by a language model on our own server. It can be wrong; the posts below are the source.

6 participants
BoYzONe Developer · 88 posts #21

nobody is perfect we share and care here..no fight or acting stupid.. 😮

winpda Junior · 38 posts #22

Good job my friends Rikuya ... i wan make more no0b topic ... hehe ...

BoYzONe Developer · 88 posts #23

some one could help me how to make online list for man only and woman only?i means what should i edit at online list script to get

woman online (10) and man online (10)

winpda Junior · 38 posts #24

very easy bro ... i'm very no0b to combine mySQL only ... haha

BoYzONe Developer · 88 posts #26

winpda so stuck up after people help him.Rukiya bro u do the right thing.Never help people like him..Unless he paste his online script for me..Long life rukiya bro!

winpda Junior · 38 posts #27

//changable sql $sql = "SELECT a.name, b.place, b.userid FROM ibwf_users a INNER JOIN ibwf_online b ON a.id = b.userid WHERE a.sex = 'M' GROUP BY 1,2 LIMIT $limit_start, $items_per_page

just change this in list to view male n female ... 'M' make 1 more for female list 'F'

BoYzONe Developer · 88 posts #28

Gud boy...Thanks. . ill try it.

winpda Junior · 38 posts #29

paste your code here for BOYZONE or you wont get any help form me next time

rukiya ... i was successfully help .... 😀

BoYzONe Developer · 88 posts #30

i stil have a problem..my male or female online less than 10 but the page jumper exist in order of all online more than 10..why?

Guest #31

Try This

😈 😈 😈

echo "Online Stats"; echo " "; echo "Users: <a href="index.php?action=online&sid=$sid">".getnumonline()." </a>"; $noi2 = mysql_fetch_array(mysql_query("SELECT count(*) FROM ibwf_users WHERE perm>'0'")); echo "(";

$male=mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.userid) FROM ibwf_online a JOIN ibwf_users b ON a.userid = b.id WHERE b.sex='M'")); echo "M:$male[0]";

echo "/";

$female=mysql_fetch_array(mysql_query("SELECT COUNT(DISTINCT a.userid) FROM ibwf_online a JOIN ibwf_users b ON a.userid = b.id WHERE b.sex='F'")); echo "F:$female[0]"; echo ")"; echo " ";

winpda Junior · 38 posts #32

This topic as done lorh ... :D

BoYzONe Developer · 88 posts #33

No...Its not done yet..I stil have a problem with the page jumper.Do i have to alter my ibwf_online?Or add more table?

Guest #34

Its ok 😉

echo "Online Stats"; echo " "; echo "Users: <a href="index.php?action=online&sid=$sid">".getnumonline()." </a>";

$timeout = 180; $timeon = time()-$timeout; $male = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='M' AND lastact>'".$timeon."'")); echo " Male: <a href="index.php?action=maleol&sid=$sid">$male[0] </a> ";

$timeout = 180; $timeon = time()-$timeout; $female = mysql_fetch_array(mysql_query("SELECT COUNT(*) FROM ibwf_users WHERE sex='F' AND lastact>'".$timeon."'")); echo "Female: <a href="index.php?action=femol&sid=$sid">$female[0] </a> ";

echo " ";

In index.php

else if($action=="maleol") {

addonline(getuid_sid($sid),"Male online",""); echo "<card id="main" title="Male Online">";

//////ALL LISTS SCRIPT <<

if($page=="" || $page<=0)$page=1;
$timeout = 180;

$timeon = time()-$timeout; $noi = mysql_fetch_array(mysql_query("SELECT COUNT() FROM ibwf_users WHERE sex='M' AND lastact>'".$timeon."'")); $num_items = $noi[0]; //changable $items_per_page= 10; $num_pages = ceil($num_items/$items_per_page); if($page>$num_pages)$page= $num_pages; $limit_start = ($page-1)$items_per_page; if($limit_start<0)$limit_start=0; //changable sql $sql = " SELECT name, sex, id FROM ibwf_users WHERE sex='M' AND lastact>'".$timeon."' LIMIT $limit_start, $items_per_page"; echo "

"; $items = mysql_query($sql); echo mysql_error(); while ($item = mysql_fetch_array($items))

  $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
 
echo "

"; echo " "; echo"$lnk "; echo " "; echo " "; if($page>1) { $ppage = $page-1; echo "<a href="index.php?action=$action&page=$ppage&sid=$sid">«</a> "; } echo "$page/$num_pages"; if($page<$num_pages) { $npage = $page+1; echo " <a href="index.php?action=$action&page=$npage&sid=$sid">»</a>"; } echo " "; if($num_pages>2) { echo getjumper($action, $sid,"index"); } echo " "; ////// UNTILL HERE >>

echo " "; echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>"; echo "Home</a>"; echo " "; echo "</card>"; }

else if($action=="femol") {

addonline(getuid_sid($sid),"Female online",""); echo "<card id="main" title="Female Online">";

//////ALL LISTS SCRIPT <<

if($page=="" || $page<=0)$page=1;
$timeout = 180;

$timeon = time()-$timeout; $noi = mysql_fetch_array(mysql_query("SELECT COUNT() FROM ibwf_users WHERE sex='F' AND lastact>'".$timeon."'")); $num_items = $noi[0]; //changable $items_per_page= 10; $num_pages = ceil($num_items/$items_per_page); if($page>$num_pages)$page= $num_pages; $limit_start = ($page-1)$items_per_page; if($limit_start<0)$limit_start=0; //changable sql $sql = " SELECT name, sex, id FROM ibwf_users WHERE sex='F' AND lastact>'".$timeon."' LIMIT $limit_start, $items_per_page"; echo "

"; $items = mysql_query($sql); echo mysql_error(); while ($item = mysql_fetch_array($items))

  $lnk = "<a href=\"index.php?action=viewuser&amp;who=$item[2]&amp;sid=$sid\">$item[0]</a>";
 
echo "

"; echo " "; echo"$lnk "; echo " "; echo " "; if($page>1) { $ppage = $page-1; echo "<a href="index.php?action=$action&page=$ppage&sid=$sid">«</a> "; } echo "$page/$num_pages"; if($page<$num_pages) { $npage = $page+1; echo " <a href="index.php?action=$action&page=$npage&sid=$sid">»</a>"; } echo " "; if($num_pages>2) { echo getjumper($action, $sid,"index"); } echo " "; ////// UNTILL HERE >>

echo " "; echo "<a href="index.php?action=main&sid=$sid"><img src="images/home.gif" alt="*"/>"; echo "Home</a>"; echo " "; echo "</card>"; }

BoYzONe Developer · 88 posts #35

thats the finishing of this topic.thanks bhvalter!!

winpda Junior · 38 posts #36

owh jumper ... thank bhvalter

Write your reply now; next you create a free account (or sign in) and it is posted right away. Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close