HTTP500 error reported when connecting to the database

Source: Internet
Author: User
When connecting to the database, the error HTTP500 is returned.

Running environment: IIS7.0 + PHP5.32 + SQL2005
When the PHP webpage is opened normally, the error HTTP500 is reported when you connect to the database. Find a solution.
The database connection code is as follows:

// Link to the database
$ Conn = mssql_connect ('192. 0.0.1 ', 'KT 99ctqc', 'c09076789101234w') or die ('database connection failure ');
Mssql_select_db ('agencyhdfc ', $ conn );
// Query statement
$ Query = "select max (propertyno) from property where propertyno like 'XX % '";

$ AdminResult = mssql_query ($ Query );
// Output result
$ Num = mssql_num_rows ($ AdminResult );
For ($ I = 0; $ I <$ Num; $ I ++)
{
$ Row = mssql_fetch_array ($ AdminResult );
Echo ($ Row [0]);
Echo ("
");
}

Echo ($ row [0]);


Reply to discussion (solution)

Enable the error prompt function to see if there is any error.

How is your database connection so troublesome? the php database connection we just learned recently:
<〈? Php
$ Link = mysqy_connect ('127. 0.0.1 ', 'KT 99ctqc', 'c09076789101234w ');
If (! $ Link) echo "failed ";
Else echo "successful ";
Mysql_close ($ link );
? > 〉

Oh, it seems that there are no errors in the connection and operation of your database !!!

Debugging. generally, it is useless to report an error. 500 more reasons

Check apache logs

I am connected to MSSQL. IIS is used.

/Output results
$ Num = mssql_num_rows ($ AdminResult );

The function here seems to be
Mysql_num_rows

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.