• I have been trying to build a website from scratch for my logistics company. I have managed to build a website on wordpress, which is hosted by GoDaddy.

    I am trying to build a web app where users can input a docket no./ consignment tracking no. and get an estimated time of arrival (ETA) on the website for their consignment. The ETA and other details of the consignment are on a MSSQL database hosted on AWS.

    To fetch the result on the page, I have written some PHP code on a wordpress page but get the error that I don’t have the necessary driver installed. The code is as follows:

    <?php
    $servername = "xx.xxx.xx.xx,port";
    $username = "xxx";
    $password = "yyy";
    
    try {
        $conn = new PDO("mssql:host=$servername;dbname=OurDBName", $username, $password);
        // set the PDO error mode to exception
    
        $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
        echo "Connected successfully";
        }
    catch(PDOException $e)
        {
        echo "Connection failed: " . $e->getMessage();
        }
    ?>
    

    I understand from some research that I need to install a PDO driver for MSSQL in php. However, I do not understand where this would go, given that I made and ran my website from WordPress. I know goDaddy uses phpmyAdmin and I can access that but do not know ay further. Could you help?

    Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • WordPress is just one piece of software on your host account. It does not control anything outside of it, like the database server, mail server, even PHP version.
    Your host control panel should have lots of options for you to choose, including the PHP version and the PHP modules to load. If GoDaddy uses cPanel, it’s under the “Software” section.

    Moderator Yui

    (@fierevere)

    永子

    Please note, MSSQL (stands for Microsoft SQL) is completely different Database software.
    PDO MsSQL is a PHP extension (database driver) used to provide PHP functions to access that database.

    It is not supported by WordPress in any way. So you are on your own here.

    However, as Joy mentioned, you can ask your hosting support to enable PDO MsSQL PHP extension for you, if you can not do this yourself via hosting control panel.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Querying external MSSQL database’ is closed to new replies.