Querying external MSSQL database
-
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.
- The topic ‘Querying external MSSQL database’ is closed to new replies.