Jump to content

Hypnos

Members
  • Posts

    2
  • Credits

  • Joined

  • Last visited

  • Feedback

    0%

About Hypnos

Profile Information

  • Gender
    Not Telling

Hypnos's Achievements

Newbie

Newbie (1/16)

0

Reputation

  1. Hello everybody, I've a sql error with the online players script, again : Can you help me about this ? I searched without any solution for now :'( Thanks a lot ! PS : my site is in php but I don't now if my sql extentions are actived.
  2. Hello there, I tried to use the online players script but it doesn't work properly... Maybe because I'm a freaking noob, so, if someone can help me xD <?php //first you need to define db info define('mySQL_hostname', 'x.x.x.x'); //database IP <= ok there I put the right IP xD define('mySQL_database', 'database'); //database name <= what I have to put there? the name of the table where chars are? define('mySQL_username', 'user'); //database user <= ok there I put the name of the user I use to connect to phpadmin portal define('mySQL_password', 'NULL'); //database password <= the same //connects to mysql $db_link = mysql_pconnect( mySQL_hostname, mySQL_username, mySQL_password ) <= nothing here to change ? or die( 'Error connecting to mysql<br><br>'.mysql_error() ); //connects to Database $db_select = mysql_select_db( mySQL_database, $db_link ) <= nothing here to change ? or die( 'Error connecting to Database<br><br>'.mysql_error() ); //selects desired table $chars=mysql_query("SELECT * FROM characters"); <= nothing here to change ? //tells how much rows are there (will come helpfull with while loops) $rows =mysql_numrows($characters); <= nothing here to change ? $i=0; $x=0; //while $i is smaller than number of rows repeat the code <= nothing here to change ? while ($i < $rows) { $online=mysql_result($chars,$i,"online"); //looks into characters table, under column online(if player is online its "0" else "1"), at row $i if ($online == 1) { $x++; } // if column online at row $i is "1", increase $x $i++; //increase $i } print 'Online players:<em>'.$x.'<em>'; //prints out the $x number of players online ?> *praying*
×
×
  • Create New...

AdBlock Extension Detected!

Our website is made possible by displaying online advertisements to our members.

Please disable AdBlock browser extension first, to be able to use our community.

I've Disabled AdBlock