8 Replies Latest reply on Jul 22, 2010 7:22 PM by KennethSwim

    Dreamweaver CS5 PHP and MS SQL


      Does Dreamweaver CS5 support using PHP with MS SQL?

        • 1. Re: Dreamweaver CS5 PHP and MS SQL
          pziecina Adobe Community Professional



          CS5 does not natively support using php with mssql, but you can use the combination by creating a php:pdo connection to your mssql database.

          For more details on using pdo with mssql see, - http://php.net/manual/en/ref.pdo-dblib.php.


          I and many other have been asking the adobe dreamweaver team for pdo to be supported natively in dreamweaver for a few years now in order to enable dw to connect to any database, you may wish to add your 'voice' to this by submitting a feature request at - https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform.




          • 2. Re: Dreamweaver CS5 PHP and MS SQL
            pziecina Adobe Community Professional



            Do not know if you are still interested in this one, but I now have php with MSSQL working in dreamweaver, (I will be updating my php:pdo extension to include this).

            But if you wish more info on how to use php with mssql let me know.



            • 3. Re: Dreamweaver CS5 PHP and MS SQL
              Ivejazz55 Level 1

              Definitely still interested. Any help would be much appreciated. Thanks.

              • 4. Re: Dreamweaver CS5 PHP and MS SQL
                pziecina Adobe Community Professional



                This works with both the SQL Server 2008 Developers edition and the SQL server 2008 Express edition.


                The first thing to ensure is that you have the mssql client for the mssql database installed, (also known as the SQL Server management studio), then go here and download the server driver for php - http://sqlsrvphp.codeplex.com/, I would recommend the release candidate as this support php 5.2 and 5.3, (it is named as "SQL server driver for php 2") yes the name is misleading!


                Unpack the file into a temp, directory, then copy the files required to your php extensions directory, (the two files required will depend on your version of php, check the documentation) you do not have to use the pdo file if you are happy creating your own standard sql statements, but doing so will mean that the pdo extension must also be installed for php.


                For php 5.2 you would then add the following to your php ini file, (in the extensions section) -




                If using pdo ensure the following is also included -




                Restart your server.


                O/k, that's the easy part, now to check the installation. For this I installed the "AdventureWorks" database, which you can get here - http://sqlserversamples.codeplex.com/releases/view/45923.


                Use the SQL management studio to check the database installed correctly, (while you are there make a note of your server name, and user name and password if not using your windows authentication).


                Now to see if the installation is correct/


                Open dreamweaver and create a new, (blank) php page, replace all the code, (all the html code) with the following, (the examples give in the help files by Microsoft are wrong) -

                The section I have highlighted in red, change this to match your sql server name.

                try {
                   $conn = new PDO( "sqlsrv:Server=PAULAS-PC\SQLEXPRESS;Database=AdventureWorks", NULL, NULL);
                   $conn->setAttribute( PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION );}


                catch( PDOException $e ) {
                   die( "Error connecting to SQL Server" );


                echo "Connected to SQL Server\n";


                $query = 'select * from Person.ContactType';
                $stmt = $conn->query( $query );
                while ( $row = $stmt->fetch( PDO::FETCH_ASSOC ) ){
                   print_r( $row );


                The NULL and NULL in the connection string, ($conn = new PDO...) indicates that you are using the windows authentication, if not replace these with your user name and password respectively.


                Save the page and select 'live view', the first four words should say "Connected to SQL server".


                As I said, I am currently working on including the MSsql connection as part of my "php/mysql pdo extension", which is very 'rough code' at the moment and the items are not fully compatible with how dreamweaver normally works, which means I am using mysql for some development, (creating the basic recordsets etc.) and then pasting/modifying the code into the mssql pages for testing.


                If your interested, the extension can be downloaded here - http://www.pziecina.com/design/dreamweaver/pdo_extension.php, the log-in/out etc are done but not included yet.


                Let me know how you get on with this, and if you have any problems.


                Paula Z

                • 5. Re: Dreamweaver CS5 PHP and MS SQL
                  Ivejazz55 Level 1

                  This looks promising. I'll let you know how it goes. Thanks very much.



                  • 6. Re: Dreamweaver CS5 PHP and MS SQL
                    David_Powers Adobe Community Professional (Moderator)

                    In addition to Paula's extension, you might also be interested to know that you can connect to MS SQL Server using Zend_Db in the Zend Framework.


                    Instead of creating new server behaviors in CS5, Adobe decided to put a major effort into supporting third-party libraries in Dreamweaver. Code introspection and Site-Specific Code Hints has made working with libraries such as the Zend Framework much easier. I have written "Adobe Dreamweaver CS5 with PHP: Training from the Source", which is due to be published by Adobe Press next month. Only one chapter covers server behaviors. The rest of the book is devoted to working with components of the Zend Framework or a CMS, such as WordPress.

                    • 7. Re: Dreamweaver CS5 PHP and MS SQL
                      Stephen Cox Level 1

                      There are several other ways to connect to MSSQl from PHP. But you gonna have to it by hand. Unless if you use pziecina's PDO extension (by the way, thanks a bunch for that, pziecina).


                      But take a look at Pear  too. Or something like ezSQL @ http://www.woyano.com/view/213/Download-ezSQL-Database-Class-205

                      ezSQL is a database class. Can use it to connect to MSSQL.


                      Pear is a huge library of PHP mods.. including an excellent database class. And then of course, the big daddy of them all, ZEND.  Though doesn't ZEND use Pear?


                      And David, I eagerly await your book. I have your other book: PHP object-oriented solutions.

                      • 8. Re: Dreamweaver CS5 PHP and MS SQL

                        Dave: i wrote a very nice review of your dreamweaver cs4 book on amazon. I used your connQuery.php that you suggested in the recordset in your book, but a search on my computer can not find such a file, and the program does not work in gallery_eng.php that we created. The code refers to <?php require_once('/Connections/connQuery');?>  That does not work , but the recordset was created. What can I do about that. I have windows 7 and a wamp server, the latest version. thanks Ken Carlson