Can we use php with sql?
I work primarly with PHP & MySQL, but I have a potential client with a MS SQL and ASP setup. Due to some complicated reasons and offline software integration, they need to keep the databases in the same format, which means not moving to MySQL which would be my personal preference. Show So the question is can I use PHP to access and manipulate an MS SQL database or am I screwed on this one? Thanks in advance asked Mar 23, 2011 at 17:11
1 Yes, you can. It depends on which version of PHP you're using, but if you're using PHP5+ you can use Microsoft's SQL Server Driver for PHP. Make sure you use version 2, which gives you the PDO functionality as well as the procedural style. You can also use the PDO ODBC driver to access a SQL Server instance, but that approach is more buggy and I don't recommend it. Finally you can use the PHP MSSQL library but that's even worse. Go with Microsoft's own solution if you can. Edit: Oh, and there's also the DBLIB MSSQL PDO driver - stay away from that one too!
Josh 10.9k11 gold badges67 silver badges106 bronze badges answered Mar 23, 2011 at 17:17
CraigCraig 2,1611 gold badge18 silver badges20 bronze badges 2 Yes. As long as you have the php_mssql extension on your server, you can use the following common functions:
Note: From PHP 5.3 this extension is not included (and probably not maintained). You can download and add it manually, or better use Microsoft drivers.
T30 10.6k6 gold badges52 silver badges57 bronze badges answered Mar 23, 2011 at 18:18
psparrowpsparrow 9,6281 gold badge16 silver badges11 bronze badges yes you can connect to MsSQL . If you are using wamp then switch on the php extension php_mssql if not then use the php.ini file and modify it answered Mar 23, 2011 at 17:15
Yes, you can use MS SQL and PHP together. Here is just a page from the PHP.net showing all the functions and commands: MS SQL and PHP It explains everything you need. answered Mar 23, 2011 at 17:16
DelphyDelphy 3061 gold badge4 silver badges15 bronze badges answered Mar 23, 2011 at 17:17
mraveymravey 4,2602 gold badges20 silver badges28 bronze badges For me the solution has been to install the MS drivers as indicated above, and use ADODB library as intermediate. I've had this in production in an intranet over IIS6 and latest MSSQLExpress for months without any issue, perfectly reliable. answered Sep 12, 2011 at 2:19
cdsaenzcdsaenz 4711 gold badge9 silver badges14 bronze badges Also you can use sqlsrv if you are using PHP5.3+ Form microsoft
Microsoft download page : microsoft sqlsrv download Microsoft SQL Server Driver for PHP Manual : php sqlsrv manual answered Dec 13, 2014 at 17:36
Can you use PHP with SQL?Yes, you can. It depends on which version of PHP you're using, but if you're using PHP5+ you can use Microsoft's SQL Server Driver for PHP.
Is PHP necessary for SQL?No, but it's required when you need to work with Databases. Mitali Jadhavrao SQL is not important in learning PHP but it is necessary especially when you are doing database administrations like Create Read Update Delete operations.
Can I connect PHP to SQL Server?Connecting to a MS SQL Server database with PHP is very similar to connecting to a MySQL database. The following example demonstrates how to connect to a MS SQL database from PHP. Note that the function names contain mssql, not mysql.
How do you connect MySQL with PHP?Here are two steps for connecting PHP to MySQL database.. Connect PHP applications with MySQL (and MariaDB).. Retrieve database server information.. Manage errors generated from database calls.. Work with database records using the Create, Read, Update, and Delete (CRUD) functions.. |