我已经通过 PHP 连接到 MS-SQL Server 2008 数据库,现在我想将数据提取到变量中,这是如何完成的?
我有以下代码:
$myServer = "214187-1";
$myUser = "ytuser";
$myPass = "***********";
$myDB = "*********";
//create an instance of the ADO connection object
$conn = new COM ("ADODB.Connection")
or die("Cannot start ADO");
//define connection string, specify database driver
$connStr = "PROVIDER=SQLOLEDB;SERVER=".$myServer.";UID=".$myUser.";PWD=".$myPass.";DATABASE=".$myDB;
$conn->open($connStr); //Open the connection to the database
//declare the SQL statement that will query the database
$query = "SELECT FacebookAppID, FacebookAppSecret, TwitterConsumerKey, TwitterConsumerSecret, LinkedinAPIKey, LinkedinSecretKey FROM Systems WHERE SystemID = " $G_SYSTEMID;
$FacebookAppID = ;
$FacebookAppSecret = ;
$TwitterConsumerKey = ;
$TwitterConsumerSecret = ;
$LinkedinAPIKey = ;
$LinkedinSecretKey = ;
$rs->Close();
$conn->Close();
$rs = null;
$conn = null;
任何帮助将不胜感激..
新杰克