1.Com link, ADODB.Connection
Copy code The code is as follows:
$ conn = new Com("ADODB.Connection"); //Instantiate a Connection object
$connstr = "provider=sqloledb;datasource=.;uid=sa;pwd=123456;database=jnold;";
$conn->Open($connstr);
$rs = new Com("ADODB.Recordset"); //Instantiate a Recordcount object
$rs->Open('select * from News where bigclassid = 59 And LeadPostil is null', $conn, 1, 1);
$count = $rs->RecordCount;
echo "There are {$count} records in total
";
for($i = 0; $i < $count ; $i++){
$arr_result[$i]['Title'] = addslashes($rs-> Fields('Title')->Value);//Title
$arr_result[$i]['Color'] = addslashes($rs->Fields('titlecolor')->Value?$rs ->Fields('titlecolor')->Value:");//Title Color
$arr_result[$i]['WenHao'] = addslashes($rs->Fields('OtherText')- >Value);//Document number
}
2.ODBC connection mssql
Copy code The code is as follows:
$dbhost = ";
$dbuser = "; //Your mssql username
$dbpass = "; //Your mssql password
$dbname = "; //Your mssql library name
$connect=odbc_connect("Driver={SQL Server};Server=$dbhost;Database=$ dbname","$dbuser","$dbpass");
$sql="select * from content";
$exec=odbc_exec($connect,$sql);
while($row = (odbc_fetch_array($exec)))
{
$row['id'] //? Get field value
…
}
http://www.bkjia.com/PHPjc/326416.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/326416.htmlTechArticle1.Com link, ADODB.Connection Copy the code as follows: $conn = new Com("ADODB.Connection" ); //Instantiate a Connection object $connstr = "provider=sqloledb;datasource=.;uid=sa;p...