Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Basic TR Website With MSSQL Connection

Newbie Spellweaver
Joined
Aug 28, 2013
Messages
18
Reaction score
1
Hello,
so... i was hardly doing some few things about tr and i did suceed,
in this tutorial
i will explain everyone how to make the top ten ranking using TR Database
and it's not manually... it's by database..
Let's Start!
First download ntwdlib.dll (Search on google)
then after that copy the ntwdlib.dll to
Apache bin folder
Apache Folder
PHP Folder (Overwrite)
Then enable these things in the php.ini
;extension=php_ming.dll => extension=php_ming.dll
;extension=php_mssql.dll => extension=php_mssql.dll
Restart Apache
after that you're ready to build the website!
so first here's the connecting codes you need :
PHP:
<?php
// Server in the this format: <computer>\<instance name> or 
// <server>,<port> when using a non default port number
$server = 'NATHAN-PC\SQLEXPRESS';
// Connect to MSSQL
$link = mssql_connect($server, 'sa', 'talesrunner') // mssql_connect($server, 'username', 'password')
 or die('Could not connect to MSSQL Server!');
// Database Name
mssql_select_db('TR_GAMESVR_DB') 
 or die('Could not select a database.');
After that you're connected to the database (only when you go to the webpage and you see no errors)
if you got an error contact me on skype (nathanadhitya)
after the connection etablished , let's open the rank table by executing an SQL Query
PHP:
$SQL = "
SELECT TOP 10 *
FROM [dbo].[tblRank]";
 
$result = mssql_query($SQL) 
    or die('An MSSQL error occured');
 
// Fetch rows:
while ($Row = mssql_fetch_assoc($result)) {
  echo $Row['fdRank'] . "   " . $Row['fdNickname'] . "   " . $Row['fdExp'];
 echo '<br>';
}
Then close the MSSQL Connection and the php
PHP:
mssql_close($link);
?>
then look back the webpage... it will return 10 rows from 1-10 so it would be the top ten rank :)
i was seperating it with a space... to seperate it with a table look the html tutorials at w3schools
Have Fun!
And here's my full code
PHP:
<?php
// Server in the this format: <computer>\<instance name> or 
// <server>,<port> when using a non default port number
$server = 'NATHAN-PC\SQLEXPRESS';
// Connect to MSSQL
$link = mssql_connect($server, 'sa', 'talesrunner') // mssql_connect($server, 'username', 'password')
 or die('Could not connect to MSSQL Server!');
// Database Name
mssql_select_db('TR_GAMESVR_DB') 
 or die('Could not select a database.');
$SQL = "
SELECT TOP 10 *
FROM [dbo].[tblRank]";
 
$result = mssql_query($SQL) 
    or die('An MSSQL error occured');
 
// Fetch rows:
while ($Row = mssql_fetch_assoc($result)) {
  echo $Row['fdRank'] . "   " . $Row['fdNickname'] . "   " . $Row['fdExp'];
 echo '<br>';
} 
mssql_close($link);
?>
 
Joined
Feb 28, 2012
Messages
738
Reaction score
65
While this is very basic and probably available to me if I asked other people, I think this is a positive release. I'll add this to the file and tools thread.
 
Newbie Spellweaver
Joined
Aug 28, 2013
Messages
18
Reaction score
1
thanks mcaso... it was soo hard for meh to do it ... takes 5 hours.. and make sure you had your php under 5.3
 
Back
Top