note 32539 deleted from function.odbc-connect by cmb
| From: | cmb@php.net | Date: | Sun, 25 Aug 2019 07:54:17 +0000 |
| Subject: | note 32539 deleted from function.odbc-connect by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-211977@lists.php.net to get a copy of this message | ||
Note Submitter: eric dot ramirez at iberoonline dot com
----
Connecting with SQL in a ODBC source
2 ways, one is if your SQL server is runign in your machine
$ser="LOCALMACHINE"; #the name of the SQL Server
$db="mydatabase"; #the name of the database
$user="myusername"; #a valid username
$pass="my pass"; #a password for the username
# one line
$conn=odbc_connect("Driver={SQL
Server};Server=".$ser.";Database=".$db,$user,$pass);
# one line
the second way is if the SQL Server is runing in other machine but in the same network
$ser="LOCALMACHINE"; #the name of the SQL Server
$db="mydatabase"; #the name of the database
$user="myusername"; #a valid username
$pass="my pass"; #a password for the username
#one line
$conn=odbc_connect("DRIVER=SQL
Server;SERVER=".$ser.";UID=".$user.";PWD=".$pass.";
DATABASE=".$db.";
Address=".$ser.",1433","","");
#one line