How PHP connects with MSSQL

Source: Internet
Author: User
Tags mssql php and valid

In PHP wadhwahitesh windows,ms SQL Server, PHP scripting language, PHP and database
Tags: php, Mssql,wamp
I have successfully connected the MSSQL using PHP, but I got the following warning and system death. Please let me know the problem solved as soon as possible. Thank you

Warning:mssql_query (): supplied argument isn't a valid MS Sql-link resource in c:wampwwwtestsql2005index.php on line 11
Warning:mssql_fetch_array (): supplied argument is isn't a valid MS Sql-result resource in c:wampwwwtestsql2005index.php on Line 12

Line one: $qry = Mssql_query ($sql 1, $dblink);
Line 12:while ($row = Mssql_fetch_array ($qry)) {

$server = ' divine-2953ff11,<port> ';
$server = ' divine-2953ff11sqlexpress ';
$db = ' <database> ';
$dbuser = ' <username> ';
$dbpass = ' <password> ';
 
$link = Mssql_connect ($server, $dbuser, $dbpass) or Die ("Cannot connect to server");
$dblink = mssql_s elect_db ($db, $link) or Die ("Cannot connect to database");
$sql 1 = "SELECT FirstName from Dbo.persons";
$qry = Mssql_query ($sql 1, $dblink);
while ($row = Mssql_fetch_array ($qry)) {
    echo $row ["FirstName"];
}
Mssql_close ($link);

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.