PHP Operation MSSQL

Source: Internet
Author: User
$conn = @mssql_connect ("127.0.0.1", "sa", "database") or Die ("Connection error");

mssql_select_db ("test") or Die ("without this Database");

$sql = "SELECT * from Login";

$result =mssql_query ($sql);

while ($row =mssql_fetch_assoc ($result))
{
echo $row [' ID ']. " ". $row [' User '].
";

}


Mssql_close ($conn);
//==========================================================
PHP connection to SQL Server

Modify PHP.ini
1. Remove the extension=php_mssql.dll before;
2. Confirm that Extension_dir is the correct path, take this machine as an example: Extension_dir = "C:\php\extensions"

OK, restart the server, test ing ...

If not, try the following methods:

PS: In the classmate several computers are tested pass, but in the self machine report wrong said to find C:\php\extensions\php_mssql.dll but clearly exist this file.

Workaround:
Put the Php_mssql.dll,ntwdblib.dll in the system directory \system32 restart the test ...

(Note: The above two DLL files are not in the same directory, please self-lookup.) ^_____^)

  • 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.