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