helping php iss users with mssql connect

09/08/2011 11:41 Svinseladden#1
i have not see anyone realy helped with this one. but after what i have seen you need:

In versjon 5.3 of PHP was the support for php_mssql.dll removed. This uses mssql_connect() that all php files out here uses. PHP and microsoft recomend is "Microsoft Drivers for PHP for SQL Server".

this has a close syntax, but have other names.

to conect you need this.

<?php

$connectionInfo = array("UID" => "test", "PWD" => "test", "Database"=>"test");
$serverName = "localhost\SQLEXPRESS";
$conn = sqlsrv_connect( $serverName, $connectionInfo);

if( $conn )
{
echo "Connection established.\n";
}
else
{
echo "Connection could not be established.\n";
die( print_r( sqlsrv_errors(), true));
}

/* Close the connection. */
sqlsrv_close( $conn);
?>

hope this helps. and mabe some now will take the prob and make a working "new" php for all that still want to use iss manger for php windows..

this is from 5.3+ i'm not sure if the old php can be used on iss 7.5 windows server 2008 still working on that one. but there is a fix i hope..
09/08/2011 15:07 Svinseladden#2
Quote:
Originally Posted by castor4878 View Post
do you mean: expect in the response I gave to you in a [Only registered and activated users can see links. Click Here To Register...] ??

do i have to add: "quote your sources", "don't re-invert warm water", etc, etc ?
sorry castor i did not see that one.. so sorry..

just hade to be one of those day's when i did read that one.. i totaly forgot about it..
09/09/2011 18:46 zargon05#3
You could probably just go in for ODBC which requires no installation of additional files.
09/09/2011 19:27 Svinseladden#4
yea but stuff is, my php skills are lets say on the bad side. so if anyone could make the odbc or the new microsoft thingy that would be great. all have mssql connect that not many can use making servers ahead. so the odbc or the new will be much more used ahed in time..

like online players, ress players,Statistics, top players. top pvp and so on..
09/10/2011 09:21 Svinseladden#5
well i don't care if it's odbc or microsoft driver ppl use if any will mape php for that we can use i'll be happy
09/10/2011 15:03 zargon05#6
Actually if you look at some of the documentation, SQLSRV provided from Microsoft is built on top of ODBC driver as described [Only registered and activated users can see links. Click Here To Register...]
09/10/2011 16:45 viper4513#7
Still prefer the DBLib version that Castor explained in the original php script topic over the ODBC version.

After reading that i managed to get my sources all set up and working correctly with SQL 2008 and WAMP server v2.0.

And i'm a complete noob with php, and all Apachi things, never even used them before i read through that topic.
09/18/2011 05:58 AdminCORE#8
hi
where can i find php files so i can replace with these?
09/18/2011 12:24 viper4513#9
depends what php source you are actually looking for.. registration, pvp ranks, ressurection... use the search, or look through the Dev Section.
09/25/2011 15:59 [ADMIN]Cryptic#10
I cant get the mssql function to properly work with ISS7. I get this error.

Fatal error: Call to undefined function mssql_query() in C:\inetpub\wwwroot\rank.php on line 17

its not an error in the code its that the PHP extension havent been installed properly or something. But I am trying and it doesnt seem to work nomatter what I try. Anyone have experience with this?
09/25/2011 18:58 RebeccaBlack#11
In PHP 5.3, MSSQL functions are deprecated and removed.

You either need to use an older version, or use one of the other alternatives.
  • ODBC
  • SQLSRV
09/27/2011 01:47 [ADMIN]Cryptic#12
so what version would you suggest I downgrade to, to make most these scripts work? especially the mssql query ones.
09/27/2011 05:11 RebeccaBlack#13
Eh, why downgrade? Just use one of the current versions, and make use with SQLSrv or ODBC o.O
09/29/2011 10:16 [ADMIN]Cryptic#14
sorry but that dont help lol I already use ODBC to connect to the sql but I have no idea how I can get quries to work so I cant make a top players list and etc.
I am completly new with PHP.


edit: I have used way to much time trying to get this to work but atleast I know now that its because mssql doesnt work with my version of PHP

I have to ask though can you please tell me how I make this script work without mssql_functions. I only found a few I could replace. I really hope you can help cos this is making me tear my hair out lol.

PHP Code:
<?php
//here you must to replace data with your 
$server '127.0.0.1';
$dbuser 'Shaiya';
$dbpass 'Shaiya123';
$count=1;
$rimg=0;
$cimg=0;
$kdr=0;
$topcount=100;//joker's remake : variable "$topcount" defined rows (1~N) in the table of top(N) players.

//connection with database
$conn mssql_connect($server$dbuser$dbpass) or die("Couldn't connect to SQL Server on $myServer"); 
 
$query "SELECT  c.CharID,c.CharName,c.K1,c.K2,c.Job,c.Level,umg.Country FROM PS_GameData.dbo.Chars c INNER JOIN
PS_UserData.dbo.Users_Master um ON c.useruid=um.useruid INNER JOIN 
PS_GameData.dbo.UserMaxGrow umg ON umg.UserUID=c.UserUID WHERE
um.status=0 AND c.Del=0 ORDER BY c.k1 DESC"
;
$result mssql_query($query);

echo 
"<html><head><STYLE TYPE=\"text/css\">
<!--
td { background:url(image.png) no-repeat; }
td.i0{ background-position: 0 0; width: 28px; height: 16px; } 
td.i1{ background-position: 0 -26px; width: 28px; height: 16px; } 
td.i2{ background-position: 0 -52px; width: 28px; height: 16px; } 
td.i3{ background-position: 0 -78px; width: 29px; height: 16px; } 
td.i4{ background-position: 0 -104px; width: 29px; height: 15px; } 
td.i5{ background-position: 0 -129px; width: 28px; height: 18px; } 
td.i6{ background-position: 0 -157px; width: 30px; height: 17px; } 
td.i7{ background-position: 0 -184px; width: 29px; height: 17px; } 
td.i8{ background-position: 0 -211px; width: 28px; height: 16px; } 
td.i9{ background-position: 0 -237px; width: 28px; height: 18px; } 
td.i10{ background-position: 0 -265px; width: 29px; height: 18px; } 
td.i11{ background-position: 0 -293px; width: 29px; height: 24px; } 
td.i12{ background-position: 0 -327px; width: 29px; height: 18px; } 
td.i13{ background-position: 0 -355px; width: 29px; height: 18px; } 
td.i14{ background-position: 0 -383px; width: 29px; height: 18px; } 
td.i15{ background-position: 0 -411px; width: 29px; height: 18px; } 
td.i16{ background-position: 0 -439px; width: 29px; height: 18px; } 
td.i17{ background-position: 0 -467px; width: 24px; height: 24px; } 
td.i18{ background-position: 0 -501px; width: 24px; height: 24px; } 
td.i19{ background-position: 0 -535px; width: 24px; height: 24px; } 
td.i20{ background-position: 0 -569px; width: 24px; height: 24px; } 
td.i21{ background-position: 0 -603px; width: 24px; height: 24px; } 
td.i22{ background-position: 0 -637px; width: 24px; height: 24px; } 
</STYLE>
<title>PvP Rankings</title></head>"
;
echo 
"<body><center>
      <table cellspacing=10 cellpadding=0 border=0 bgcolor=\"black\">
      <td style=\"color:#FC9700\" bgcolor=\"black\">No:</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Name</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Class</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Level</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Kills</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Death</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">KDR</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Rank</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Faction"
;      

 
 while(
$count != ($topcount+1)) //joker's remake : check the end of table  
   
{
   
$row mssql_fetch_array($result);
   
$cimg $row[4]+17;
         if(
$row[2] >= 200000)
            
$rimg=16;
           else if(
$row[2] >= 150000)
            
$rimg=15;
           else if(
$row[2] >= 130000)
            
$rimg=14;
           else if(
$row[2] >= 110000)
            
$rimg=13;
           else if(
$row[2] >= 90000)
            
$rimg=12;
           else if(
$row[2] >= 70000)
            
$rimg=11;
           else if(
$row[2] >= 50000)
            
$rimg=10;
           else if(
$row[2] >= 40000)
            
$rimg=9;
           else if(
$row[2] >= 30000)
            
$rimg=8;
           else if(
$row[2] >= 20000)
             
$rimg=7;
           else if(
$row[2] >= 10000)
            
$rimg=6;
           else if(
$row[2] >= 5000)
            
$rimg=5;
           else if(
$row[2] >= 1000)
            
$rimg=4;
           else if(
$row[2] >= 300)
            
$rimg=3;
           else if(
$row[2] >= 50)
            
$rimg=2;
           else if(
$row[2] >= 1)
            
$rimg=1;
           else 
            
$rimg=0;
            
            if(
$row[6]==0//joker's remake : check the faction    
             
$faction="AOL";
            else
             
$faction="UOF";    
           
           if(
$row[3]===0)
            
$kdr=number_format($row[2]/1,3,'.','');
           else
            
$kdr=number_format($row[2]/$row[3],3,'.',''); 
            
           echo 
"<tr style=\"color:white\">";
           echo 
"<td>$count</td><td>"$row[1] ."</td><td class=\"i$cimg\"></td><td>"$row[5] ."</td><td>"$row[2] . "</td><td>"$row[3] .
           
"</td><td>".$kdr."</td><td class=\"i$rimg\"></td><td>$faction</td><td>";
           echo 
"</tr>";
           
$count++;                  
    }
echo 
"</table>";
echo 
"</html>";

mssql_close($conn);
?>
09/29/2011 12:50 RebeccaBlack#15
Quote:
Originally Posted by [ADMIN]Cryptic View Post
sorry but that dont help lol I already use ODBC to connect to the sql but I have no idea how I can get quries to work so I cant make a top players list and etc.
I am completly new with PHP.


edit: I have used way to much time trying to get this to work but atleast I know now that its because mssql doesnt work with my version of PHP

I have to ask though can you please tell me how I make this script work without mssql_functions. I only found a few I could replace. I really hope you can help cos this is making me tear my hair out lol.
PHP Code:
<?php
//here you must to replace data with your
$server '127.0.0.1';
$dbuser 'Shaiya';
$dbpass 'Shaiya123';
$count=1;
$rimg=0;
$cimg=0;
$kdr=0;
$MaxRank 100;

//connection with database
$conn = @odbc_connect("Driver={SQL Server};Server=$server;"$dbuser$dbpass) or die("Database Connection Error!");;

$query "SELECT TOP ".$MaxRank." c.CharName,c.K1,c.K2,c.Job,c.Level,umg.Country 
FROM PS_GameData.dbo.Chars c
INNER JOIN PS_UserData.dbo.Users_Master um ON c.useruid=um.useruid
INNER JOIN PS_GameData.dbo.UserMaxGrow umg ON umg.UserUID=c.UserUID 
WHERE um.status=0 AND c.Del=0 ORDER BY c.k1 DESC"
;
$result odbc_exec($conn$query);

echo 
"<html><head><STYLE TYPE=\"text/css\">
<!--
td { background:url(image.png) no-repeat; }
td.i0{ background-position: 0 0; width: 28px; height: 16px; }
td.i1{ background-position: 0 -26px; width: 28px; height: 16px; }
td.i2{ background-position: 0 -52px; width: 28px; height: 16px; }
td.i3{ background-position: 0 -78px; width: 29px; height: 16px; }
td.i4{ background-position: 0 -104px; width: 29px; height: 15px; }
td.i5{ background-position: 0 -129px; width: 28px; height: 18px; }
td.i6{ background-position: 0 -157px; width: 30px; height: 17px; }
td.i7{ background-position: 0 -184px; width: 29px; height: 17px; }
td.i8{ background-position: 0 -211px; width: 28px; height: 16px; }
td.i9{ background-position: 0 -237px; width: 28px; height: 18px; }
td.i10{ background-position: 0 -265px; width: 29px; height: 18px; }
td.i11{ background-position: 0 -293px; width: 29px; height: 24px; }
td.i12{ background-position: 0 -327px; width: 29px; height: 18px; }
td.i13{ background-position: 0 -355px; width: 29px; height: 18px; }
td.i14{ background-position: 0 -383px; width: 29px; height: 18px; }
td.i15{ background-position: 0 -411px; width: 29px; height: 18px; }
td.i16{ background-position: 0 -439px; width: 29px; height: 18px; }
td.i17{ background-position: 0 -467px; width: 24px; height: 24px; }
td.i18{ background-position: 0 -501px; width: 24px; height: 24px; }
td.i19{ background-position: 0 -535px; width: 24px; height: 24px; }
td.i20{ background-position: 0 -569px; width: 24px; height: 24px; }
td.i21{ background-position: 0 -603px; width: 24px; height: 24px; }
td.i22{ background-position: 0 -637px; width: 24px; height: 24px; }
</STYLE>
<title>PvP Rankings</title></head>"
;
echo 
"<body><center>
      <table cellspacing=10 cellpadding=0 border=0 bgcolor=\"black\">
      <td style=\"color:#FC9700\" bgcolor=\"black\">No:</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Name</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Class</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Level</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Kills</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Death</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">KDR</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Rank</td>
      <td style=\"color:#FC9700\" bgcolor=\"black\">Faction"
;      

while(
$row odbc_fetch_array($result)){
   
$cimg $row['Job']+17;
         if(
$row['K1'] >= 200000)
            
$rimg=16;
           else if(
$row['K1'] >= 150000)
            
$rimg=15;
           else if(
$row['K1'] >= 130000)
            
$rimg=14;
           else if(
$row['K1'] >= 110000)
            
$rimg=13;
           else if(
$row['K1'] >= 90000)
            
$rimg=12;
           else if(
$row['K1'] >= 70000)
            
$rimg=11;
           else if(
$row['K1'] >= 50000)
            
$rimg=10;
           else if(
$row['K1'] >= 40000)
            
$rimg=9;
           else if(
$row['K1'] >= 30000)
            
$rimg=8;
           else if(
$row['K1'] >= 20000)
             
$rimg=7;
           else if(
$row['K1'] >= 10000)
            
$rimg=6;
           else if(
$row['K1'] >= 5000)
            
$rimg=5;
           else if(
$row['K1'] >= 1000)
            
$rimg=4;
           else if(
$row['K1'] >= 300)
            
$rimg=3;
           else if(
$row['K1'] >= 50)
            
$rimg=2;
           else if(
$row['K1'] >= 1)
            
$rimg=1;
           else
            
$rimg=0;
            
            if(
$row['Country']==0)
             
$faction="AOL";
            else
             
$faction="UOF";    
          
           if(
$row['K2'] == 0)
            
$kdr=number_format($row['K1'],3,'.','');
           else
            
$kdr=number_format($row['K1']/$row['K2'],3,'.','');
            
           echo 
"<tr style=\"color:white\">";
           echo 
"<td>$count</td><td>"$row['CharName'] ."</td><td class=\"i$cimg\"></td><td>"$row['Level'] ."</td><td>"$row['K1'] . "</td><td>"$row['K2'] .
           
"</td><td>".$kdr."</td><td class=\"i$rimg\"></td><td>$faction</td><td>";
           echo 
"</tr>";
           
$count++;                  
    }
echo 
"</table>";
echo 
"</html>";

odbc_close($conn);
?>
I suppose this will work.. I modified a few things, sorry if you didn't want that, but I'm sure it'll be easy to put them back in if needed.