I usually work with PHP MySQL and resultantly, my knowledge with MsSQL is somewhat limited. I am about to write a class that makes executing MsSQL queries much easier for myself and my associates. However, in my research, I have found that I have two options of how to connect to an MsSQL database; I can either use the PHP PDO Library or the SQLSRV API. The latter seems the better option for me as I am unfamiliar with the PDO library and how it works, although, I would be willing to learn more about the PDO library if it is the much better choice.
So effectively, I would simply like to know which option is better for communicating with an MsSQL database using PHP?
In addition, is anybody familiar with a good site with examples and documentation of the API? The Microsoft website is good, but somewhat biased and limited.
Any help much appreciated, thanks.
I would recommend you to learn PDO.
Where MySQL(i) is only for MySQL, and SQLSRV API is only for MsSQL, PDO is for around 20 different database engines. Plus, it’s object oriented and supports named parameters in prepared statements.
See this great article (it’s about PDO vs MySQLi, but the arguments there are valid)