php下使用以下代码连接并测试

前端之家收集整理的这篇文章主要介绍了php下使用以下代码连接并测试前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

<div class="codetitle"><a style="CURSOR: pointer" data="94988" class="copybut" id="copybut94988" onclick="doCopy('code94988')"> 代码如下:

<div class="codebody" id="code94988">
<?PHP $myServer="localhost";//主机
$myUser="sa";//用户名
$myPass="password";//密码
$myDB="Northwind";?//MSsql库名 $s=@mssql_connect($myServer,$myUser,$myPass)
ordie("Couldn'tconnecttosqlServeron$myServer"); $d=@mssql_select_db($myDB,$s)
ordie("Couldn'topendatabase$myDB"); $query="SELECTTitleOfCourtesy+''+FirstName+''+LastNameASEmployee";
$query.="FROMEmployees";
$query.="WHERECountry='USA'ANDLeft(HomePhone,5)='(206)'"; $result=mssql_query($query);
$numRows=mssql_num_rows($result); echo"

".$numRows."Row".($numRows==1?"":"s")."Returned

"; while($row=mssql_fetch_array($result))
{
echo"
  • ".$row["Employee"]."
  • ";
    }

    猜你在找的PHP相关文章