An HTTP500 exception is reported when you connect to the database.

Source: Internet
Author: User
When connecting to the database, the running environment of HTTP500 error is: IIS7.0 + PHP5.32 + SQL2005 open the PHP webpage normally, connect to the database, and report the HTTP500 error. Find a solution. The database connection code is as follows: & lt ;? Php connection database & nbsp; $ connmssql_connect (127.0.0.1, KT99CtQC, C09076789101234w connection to the database, an error of HTTP500 is reported
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]);

HTTP500 error

Share:


------ Solution --------------------
Enable the error prompt function to see if there is any error.
------ Solution --------------------
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 );
? > 〉

------ Solution --------------------
Oh, it seems that there are no errors in the connection and operation of your database !!!
------ Solution --------------------
Debugging. generally, it is useless to report an error. 500 more reasons
------ Solution --------------------
Check apache logs
------ Solution --------------------
/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.