Report HTTP500 error when connecting to database
Operating environment is: iis7.0+php5.32+sql2005
Open PHP Web page is normal, connected to the database, reported HTTP500 error. Find a solution.
The code for connecting to the database is as follows:
Link Database
$conn =mssql_connect (' 127.0.0.1 ', ' kt99ctqc ', ' c09076789101234w ') or Die (' database not connected ');
mssql_select_db (' AGENCYHDFC ', $conn);
Query statement
$Query = "Select Max (Propertyno) from the property where Propertyno like ' xx% '";
$AdminResult =mssql_query ($Query);
Output results
$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 to:
------Solution--------------------
Turn on the error notification function to see if there are any errors.
------Solution--------------------
You this database connection how so troublesome, we recently just learned the PHP database connection:
〈?php
$link =mysqy_connect (' 127.0.0.1 ', ' kt99ctqc ', ' c09076789101234w ');
if (! $link) echo "failed";
else echo "Success";
Mysql_close ($link);
? 〉
------Solution--------------------
Oh, initially it seems you have no errors in connection and operation of this database!!!
------Solution--------------------
debugging to see it, the general error is useless to ask. 500 more reasons.
------Solution--------------------
Check the Apache log
------Solution--------------------
/Output Results
$Num =mssql_num_rows ($AdminResult);
The function here seems to be
Mysql_num_rows.