|
You last visited: Today at 02:47
Advertisement
helping php iss users with mssql connect
Discussion on helping php iss users with mssql connect within the Shaiya PServer Development forum part of the Shaiya Private Server category.
09/08/2011, 11:41
|
#1
|
elite*gold: 0
Join Date: Feb 2010
Posts: 675
Received Thanks: 240
|
helping php iss users with mssql connect
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
|
#2
|
elite*gold: 0
Join Date: Feb 2010
Posts: 675
Received Thanks: 240
|
Quote:
Originally Posted by castor4878
do you mean: expect in the response I gave to you in a  ??
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
|
#3
|
elite*gold: 0
Join Date: Aug 2010
Posts: 241
Received Thanks: 255
|
You could probably just go in for ODBC which requires no installation of additional files.
|
|
|
09/09/2011, 19:27
|
#4
|
elite*gold: 0
Join Date: Feb 2010
Posts: 675
Received Thanks: 240
|
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
|
#5
|
elite*gold: 0
Join Date: Feb 2010
Posts: 675
Received Thanks: 240
|
well i don't care if it'****** or microsoft driver ppl use if any will mape php for that we can use i'll be happy
|
|
|
09/10/2011, 15:03
|
#6
|
elite*gold: 0
Join Date: Aug 2010
Posts: 241
Received Thanks: 255
|
Actually if you look at some of the documentation, SQLSRV provided from Microsoft is built on top of ODBC driver as described
|
|
|
09/10/2011, 16:45
|
#7
|
elite*gold: 0
Join Date: Jul 2009
Posts: 408
Received Thanks: 180
|
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
|
#8
|
elite*gold: 0
Join Date: Aug 2011
Posts: 12
Received Thanks: 0
|
hi
where can i find php files so i can replace with these?
|
|
|
09/18/2011, 12:24
|
#9
|
elite*gold: 0
Join Date: Jul 2009
Posts: 408
Received Thanks: 180
|
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
|
#10
|
elite*gold: 0
Join Date: Sep 2011
Posts: 140
Received Thanks: 147
|
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
|
#11
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
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.
|
|
|
09/27/2011, 01:47
|
#12
|
elite*gold: 0
Join Date: Sep 2011
Posts: 140
Received Thanks: 147
|
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
|
#13
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
Eh, why downgrade? Just use one of the current versions, and make use with SQLSrv or ODBC o.O
|
|
|
09/29/2011, 10:16
|
#14
|
elite*gold: 0
Join Date: Sep 2011
Posts: 140
Received Thanks: 147
|
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
|
#15
|
elite*gold: 0
Join Date: Sep 2010
Posts: 520
Received Thanks: 1,289
|
Quote:
Originally Posted by [ADMIN]Cryptic
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.
|
|
|
 |
|
Similar Threads
|
MSSQL-connect Problem
07/02/2011 - Flyff Private Server - 0 Replies
Ich versuche seit einer Stunde Treachery CS-Shop zum laufen zu kriegen, aber ich schaffe es einfach nicht das PHP sich endlich mal meinem Willen beugt und sich mit meiner DB verbindet...
Ich gebe in die config.php datei brav meine Daten ein, allerdings will es trotzdem nicht klappen...
http://img18.imageshack.us/img18/2105/mssql.png
http://img220.imageshack.us/img220/8788/configr.p ng
http://img31.imageshack.us/img31/7397/resultata.p ng
Wäre echt nett, wenn mir jemand einen Tipp geben...
|
[NOTICE] Unable to connect to MSSQL server using XAMPP
12/06/2010 - Dekaron Private Server - 0 Replies
Hi,
i would like to notice that if you use XAMPP and install Apache as Service
it happened to me for some reason
Error:
you might have a ERROR "Unable to connect to server ..."
if you try to load a page that contains a mssql connection
This seems to happen on XAMPP for windows 1.7.3
|
Giving a 78 2 hand on Posidon for helping me connect my xbox360 to pc
11/29/2009 - Silkroad Online Trading - 2 Replies
Hey all iam giving a 78 2 hand sword on posidon for anyone can help me connect xbox 360 to my pc windows
i guess its the best offer ;)
my msn:
[email protected]
my skype:
maged.edward
|
[Helping Topic] 24/7 Helping Services!
08/27/2008 - EO PServer Hosting - 31 Replies
stucked on anything while setuping your server?
post your problem here and you will get answer as fast as possible better than spamming with posts :cool:
first of all try reading Ahmedpotop's Pserver All thing guide.
if your couldn't solve it out post your problem down here
""That includes PHP rankings pages / registrations pages / Status pages""
|
All times are GMT +1. The time now is 02:47.
|
|