I have installed and configured FreeTDS on my CentOS environment to enable my PHP code to get connect to some external MSSQL server. I have my entire application running on written using PDO which is running perfectly on windows. Just wanted to know if my same PDO code can be used even in CentOS or else I have to convert entire code from PDO to mssql_query form.
Like in PDO I have :
$statement_keyword = $obj->conn->prepare($keywordquery);
$statement_keyword->execute();
$rows_keyword = $statement_keyword->fetchAll(PDO::FETCH_ASSOC);
In MSSQL using FreeTDS we have to write
$result = mssql_query($keywordquery);
while ($Row = mssql_fetch_assoc($result)) {
$iw[$i++]=(string)$Row['FullName'];
.......
}
Means I have to run thru entire loop to get the record array, similarly there may be more changes that I need to make like in stored procedures execution …
Can anyone guide me in using PDO for MSSQL on CentOS, or an easy way other round.
Thanks
After looking for net and doing some research and experimental work I realised it is very easy to use the PDO code for windows to PDO equivalent without must changes, the only change I need to make was in the manner the connection is establised
Using PDO with MSSQL In windows
Using PDO with MSSQL on CentOS
Make sure you have configured FreeTDS, ODBC , etc on your CentOS Stack