Report HTTP500 exception when connecting to database

Source: Internet
Author: User
Tags php database apache log
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.
  • 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.