Php connection to mssql database

Source: Internet
Author: User
Php connects to the mssql Database. The original program is to connect to mysql. now I want to convert it to mssql. because I didn't use pdo & nbsp; ado or other methods to connect to the database, I have to modify the php configuration file. the mssql & nbsp; program has opened an error: fatal & nbsp; error: & nbsp; Call & nbsp; t php connection to mssql database
The original program is connected to mysql
Now you want to convert it to mssql
Because pdo ado and other methods are not used for connection
So you have to modify the program yourself.
When the mssql program has been opened in the php configuration file, the following error occurs:
Fatal error: Call to undefined function mssql_insert_id ()
Fatal error: Call to undefined function mssql_affected_rows ()
Does mssql not have these two functions?
------ Best solution --------------------
Http://php.net/manual/en/book.mssql.php
No
However, this page provides an alternative solution:
 function mssql_insert_id() { 
    $id = 0; 
    $res = mssql_query("SELECT @@identity AS id"); 
    if ($row = mysql_fetch_array($res, MYSQL_ASSOC)) { 
        $id = $row["id"]; 
    } 
    return $id; 

?>

And
Http://www.php.net/manual/en/function.mssql-rows-affected.php
------ Other solutions --------------------
Phpinfo check whether the module is added
------ Other solutions --------------------
If it is php 5.3 or above, no
------ Other solutions --------------------
Reference:
Phpinfo check whether the module is added


Mssql
MSSQL Support enabled
Active Persistent Links 0
Active Links 0
Library version 7.0

Directive Local Value Master Value
Mssql. allow_persistent On
Mssql. batchsize 0 0
Mssql. compatability_mode Off
Mssql. connect_timeout 5 5
Mssql. datetimeconvert On
Mssql. max_links Unlimited
Mssql. max_persistent Unlimited
Mssql. max_procs Unlimited
Mssql. min_error_severity 10 10
Mssql. min_message_severity 10 10
Mssql. secure_connection Off
Mssql. textlimit Server default
Mssql. textsize Server default
Mssql. timeout 60 60
------ Other solutions --------------------
Reference:
If it is php 5.3 or above, no

Python 5.26
------ Other solutions --------------------
It seems that we need to put the relevant dll file under system32.
------ Other solutions --------------------
Reference:
It seems that we need to put the relevant dll file under system32.

This should not be the problem. mssql can be connected to mssql.
The two functions are useless.
------ Other solutions --------------------
On the WINDOW platform, open MSSQL-related DLL directly in PHP. ini.
On the LINUX platform, a third party is required, similar to ODBC in Windows,
It's called FREETDS...
------ Other solutions --------------------
Reference:
Http://php.net/manual/en/book.mssql.php
No
However, this page provides an alternative solution:
PHP code12345678910

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.