View previous topic :: View next topic |
Author |
Message |
unLog!c
Joined: 27 May 2004 Posts: 185 Location: Osijek
|
Posted: 17.06.2004 20:25 Post subject: broj manje |
|
|
Kako mogu u ovome kodu:
Code: |
<?php
$host = "xxx";
$username = "xxx";
$password = "xxx";
$baza = "xxx";
$link=mysql_connect($host,$username,$password) or die("nemogu se spojiti na bazu");
mysql_select_db($baza);
$kveri_juzers=mysql_query("select user_id from phpbb_users", $link);
$brojusera=mysql_num_rows($kveri_juzers);
?>
<html>
<head>
<title>AB.solute.ZERO-STUDIO</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
</head>
<body>
<?php echo "Na forumu ima $brojusera registriranih korisnika."; ?>
</body>
</html>
|
napraviti da mi prokazuje jedan broj manje??? |
_________________ Why dont you go out and play hide and go fuck your self like all other NORMAL kids? |
|
Back to top |
|
|
silence
Joined: 24 Apr 2004 Posts: 890 Location: .....ni na nebu, ni na zemlji.....
|
Posted: 17.06.2004 20:40 Post subject: |
|
|
($brojusera -1 )? |
_________________ This End-User License is an agreement between Microsoft Corporation (hereafter referred to as "Microsoft") and you, the end-user (hereafter referred to as "our bitch"). |
|
Back to top |
|
|
maxy
Joined: 07 Sep 2003 Posts: 894 Location: Zagreb
|
Posted: 17.06.2004 20:44 Post subject: |
|
|
nije svemirska znanost fakat..
<?php
$host = "xxx";
$username = "xxx";
$password = "xxx";
$baza = "xxx";
$link=mysql_connect($host,$username,$password) or die("nemogu se spojiti na bazu");
mysql_select_db($baza);
$kveri_juzers=mysql_query("select user_id from phpbb_users", $link);
$brojusera=mysql_num_rows($kveri_juzers) - 1;
?>
<html>
<head>
<title>AB.solute.ZERO-STUDIO</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1250">
</head>
<body>
<?php echo "Na forumu ima $brojusera registriranih korisnika."; ?>
</body>
</html> |
|
|
Back to top |
|
|
unLog!c
Joined: 27 May 2004 Posts: 185 Location: Osijek
|
Posted: 17.06.2004 20:47 Post subject: |
|
|
evo ga,
hvala... |
_________________ Why dont you go out and play hide and go fuck your self like all other NORMAL kids? |
|
Back to top |
|
|
zytzagoo mi3.crew
Joined: 25 Aug 2003 Posts: 1842 Location: Zagreb, Hrvatska
|
Posted: 17.06.2004 23:39 Post subject: |
|
|
Samo mala napomena:
Ovaj gornji query na bazu ti nece vracati tocan broj registriranih korisnika, ako zbog nicega onda zbog toga jer uzima i defaultnog anonymous usera, pa ti treba taj -1 koji trazis
Zato radje uzmi ovaj query:
Code: | SELECT COUNT(user_id) AS total FROM phpbb_users WHERE user_id <> -1; |
-1 je konstanta koja trenutno oznacava ANONYMOUS status usera u phpbb-u, ali ako ti je do portabilnosti i kasnijeg lakseg upgrade-a phpbb-a, napravi to tako da u tom fileu prije nego radis query za usercount includeas() phpbb-ove config.php i includes/constants.php i onda napravis upit ovako:
Code: | $sql = "SELECT COUNT(user_id) AS total FROM " . USERS_TABLE . " WHERE user_id <> " . ANONYMOUS; |
Tako je napravljeno i u samom phpbb kodu, dakle ne mozes pogrijesiti |
_________________ [+]I[+]am[+]my[+]own[+]religion[+] |
|
Back to top |
|
|
|