Newbie Spellweaver
- Joined
- Dec 15, 2010
- Messages
- 6
- Reaction score
- 2
Hello world !
This tutorial will show you how to connect on your Pangya_S4_TH DB with PHP
Step
1 - Configure Server SQL
2 - Configure PHP
3 - Connection and SQL query test
What you need :
1) Microsoft Server SQL
2) Pangya_S4_TH installed
1 - Configure Server SQL
Execute "SQL Server Configuration Manager" (
Go to "SQL Server Network Configuration" then on "Protocols for MSSQLSERVER"
Enable Named Pipes and TCP/IP by right click -> Enable (
Right click on TCP/IP => Properties
Protocol Tab => Listen All => Yes (
IP Addresses Tab => IPAll => TCP Port => 1433 (
Make sure Named Pipes and TCP/IP are Enabled in "SQL Native Client 10.0 Configuration" => "Client Protocols"
NB : If you have a 64 bits windows, you will have 2 "SQL Native Client 10.0 Configuration", one for 32 bits, and one for 64 bits
Go to "SQL Server Services"
Right click on "SQL Server (MSSQLSERVER)" => Restart (
SQL Configuration finished !
2 - Configure PHP
Install php_pdo_odbc extension for PHP
if you have WAMP/EasyPHP, you just have to delete the ";" in front of the line "extension=php_pdo_odbc.dll" in php.ini
Restart apache
PHP Configuration finished !
3 - Connection and SQL query test
Now it's time to test !
I did this SQL query to test : SELECT * FROM [Pangya_S4_TH].[dbo].[Pangya_Item_WareHouse] and it work perfectly
I hope it will help some of you to make a website to manage your Pangya Server
This tutorial will show you how to connect on your Pangya_S4_TH DB with PHP
Step
1 - Configure Server SQL
2 - Configure PHP
3 - Connection and SQL query test
What you need :
1) Microsoft Server SQL
2) Pangya_S4_TH installed
1 - Configure Server SQL
Execute "SQL Server Configuration Manager" (
You must be registered to see links
)Go to "SQL Server Network Configuration" then on "Protocols for MSSQLSERVER"
Enable Named Pipes and TCP/IP by right click -> Enable (
You must be registered to see links
)Right click on TCP/IP => Properties
Protocol Tab => Listen All => Yes (
You must be registered to see links
)IP Addresses Tab => IPAll => TCP Port => 1433 (
You must be registered to see links
)Make sure Named Pipes and TCP/IP are Enabled in "SQL Native Client 10.0 Configuration" => "Client Protocols"
NB : If you have a 64 bits windows, you will have 2 "SQL Native Client 10.0 Configuration", one for 32 bits, and one for 64 bits
Go to "SQL Server Services"
Right click on "SQL Server (MSSQLSERVER)" => Restart (
You must be registered to see links
)SQL Configuration finished !
2 - Configure PHP
Install php_pdo_odbc extension for PHP
if you have WAMP/EasyPHP, you just have to delete the ";" in front of the line "extension=php_pdo_odbc.dll" in php.ini
Restart apache
PHP Configuration finished !
3 - Connection and SQL query test
Now it's time to test !
PHP:
<?php
$server = '127.0.0.1';
$database = 'Pangya_S4_TH';
$user = 'sa';
$passwd = '*****'; //Replace ***** by your passwd
$connect = odbc_connect("Driver={SQL Server Native Client 10.0};Server=$server;Database=$database;", $user, $passwd);
$sql = '...'; //Replace ... by the SQL query
$result = odbc_exec($connect, $sql;
while($array = odbc_fetch_array($result)) {
foreach($array as $key => $value) {
echo $key . " : " . $value . "<br/>";
}
echo '<br/><br/>';
}
?>
I did this SQL query to test : SELECT * FROM [Pangya_S4_TH].[dbo].[Pangya_Item_WareHouse] and it work perfectly
I hope it will help some of you to make a website to manage your Pangya Server