Home > Backend Development > PHP Tutorial > Use the following code to connect and test under php_PHP tutorial

Use the following code to connect and test under php_PHP tutorial

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-07-21 15:52:41
Original
984 people have browsed it

复制代码 代码如下:


$myServer = "localhost"; //主机    
$myUser = "sa"; //用户名    
$myPass = "password"; //密码    
$myDB = "Northwind";? //MSSQL库名    

$s = @mssql_connect($myServer, $myUser, $myPass)    
or die("Couldn't connect to SQL Server on $myServer");    

$d = @mssql_select_db($myDB, $s)    
or die("Couldn't open database $myDB");    

$query = "SELECT TitleOfCourtesy+' '+FirstName+' '+LastName AS Employee ";    
$query .= "FROM Employees ";    
$query .= "WHERE Country='USA' AND Left(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"] . "
  • ";    
    }     


    www.bkjia.comtruehttp://www.bkjia.com/PHPjc/318889.htmlTechArticle复制代码 代码如下: ?php $myServer="localhost";//主机 $myUser="sa";//用户名 $myPass="password";//密码 $myDB="Northwind";?//MSSQL库名 $s=@mssql_connect($myServer,$my...
    Related labels:
    Statement of this Website
    The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
    Latest Issues
    php data acquisition?
    From 1970-01-01 08:00:00
    0
    0
    0
    PHP extension intl
    From 1970-01-01 08:00:00
    0
    0
    0
    How to learn php well
    From 1970-01-01 08:00:00
    0
    0
    0
    Popular Tutorials
    More>
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template