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