linux-LAMP-连接mssql代码

<?php
$n_time=time();
$n_time="张文君";
$host="192.168.5.58:1433";$sa="USER_INFO";$pwd="USER_INFO";
$dbh_4 = new PDO('dblib:host='.$host.';dbname=[MY_DB]',$sa,$pwd);
$select_memb___id_sql="DELETE FROM [MY_DB].[dbo].[USER_INFO]";
$dbh_4->query($select_memb___id_sql);
$select_memb___id_sql="INSERT INTO [MY_DB].[dbo].[USER_INFO] ([NAME], [PASS]) VALUES('$n_time','$n_time') ";
$dbh_4->query($select_memb___id_sql);
$select_memb___id_sql="SELECT [ID], [NAME], [PASS] FROM [MY_DB].[dbo].[USER_INFO]";
foreach($dbh_4->query($select_memb___id_sql) as $row_4){
echo "<pre>";	  
echo print_r($row_4);
echo "</pre>";	  
}
?>
<?php
$conn=mssql_connect("egServer70","sa","sasa");
mssql_select_db('MY_DB',$conn);
$msquery="select * from USER_INFO";
$msresults=mssql_query($msquery);
while ($row=mssql_fetch_array($msresults)) {
echo
"<li>".
$row['ID'] ." ".$row['NAME'] ." ".$row['PASS'] ."</li>";
}
?>
<?php
$mysqli=new mysqli('192.168.5.110','root','root','MY_DB','3306');
$sql="delete from t01";
$mysqli->query($sql)or die("query err<br />");
$sql="insert into t01 (`cid`)values (".time().")";
$mysqli->query($sql)or die("query err<br />");
$sql="select * from t01";
$result=$mysqli->query($sql);
while($row=$result->fetch_array()){
 echo "<pre>";
 print_r($row);
 echo "</pre>";
 }
?>
 


 

你可能感兴趣的:(linux-LAMP-连接mssql代码)