触摸屏租赁
Touch screen rental
广告机租赁
Advertising rental
机器人租赁
Robot leasing
 当前位置:首页 > > php读取mssql方法

php读取mssql方法

conn.php文件:

<? error_reporting(0);
ob_start();
$conn = new com("ADODB.Connection");
$connstr="driver={SQL Server};server=(local);uid=sa;pwd=888888;database=jsdateone";
$conn->Open($connstr);?>

index.php文件:

<? require_once('conn.php'); ?>
<?   
$ID=207;
$rs=new COM("adodb.recordset");
$rs->open("select * from [news] where [id]=$ID",$conn,1,1);
$Title=$rs->Fields(Title)->value;
$content=$rs->Fields(content)->value;
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<?
$rsbig = new com("ADODB.RecordSet");
$sqlbig="select * from Article_titleinfo";
$rsbig->Open("$sqlbig",$conn,1,1);
while(! $rsbig->eof)

?>
<TITLE><? echo $rsbig->Fields(TITLE)->value; ?></TITLE>
<meta name="keywords" content="<? echo $rsbig->Fields(keywords)->value; ?>">
<meta name="description" content="<? echo $rsbig->Fields(description)->value; ?>">
<?
$rsbig->MoveNext();
}?>
<link href="images/index.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="main">
  <table width="994" height="994" border="0" cellpadding="0" cellspacing="0" align="center">
  <tr>
<td width="230" valign="top">&nbsp;</td>
<td width="10">&nbsp;</td>
<td width="710" height="994" valign="top" class="but" style="padding:20px; text-align:left"><? echo $content; ?></td>
  </tr>
</table>

</div>
<!--2013/9/24 11:01:25-->
</body>
</html>


工作室地址:重庆石桥铺电脑城B座 | 微信:z35544216 | 网址:www.35544216.com