Aug
28
2011
0

MSSQL: Cross Apply with XML

Handy function to remember:

SELECT *
FROM orders AS o
CROSS APPLY (
SELECT linenotes + ‘,’
FROM orderLines AS ol
WHERE ol.orderID = o.orderID
FOR XML PATH(”) )
temp ( listOfLineNotes )

http://www.stillnetstudios.com/concatenating-child-rows/

Written by Tom in: Uncategorized | Tags: ,
Aug
24
2011
0

Getting PHP and Microsoft SQL Server (MSSQL) to play nice

I have a Windows Server 2008 with IIS7 installed. I’ve been pounding my head against a Microsoft constructed brick wall for the past day trying to get PHP to interact with SQL Server 2008.

http://www.microsoft.com/download/en/details.aspx?displaylang=en&id=20098

A brief Google search pulls up a download page from Microsoft with the newest SQL Server drivers for PHP:

In the package you download, there are about 9 different files. You only need to install 1 or 2 and there are no instructions as to which one is the one to install.

In my case, even installing ALL of them didn’t work. My PHPInfo() said there was sql server support, but it wouldn’t connect to the sql server.

FINALLY, I found a single post that explained it. Turned out my PHP version which was installed by IIS7 was too old! For SqlServer to work – you have to have PHP 5.2.4 or newer.
The help instructions that come with it aren’t specific enough.

http://social.msdn.microsoft.com/Forums/en/ssdsgetstarted/thread/5fa1215f-5104-40f3-ac5c-872c4812f416

Lastly, here’s a great link that goes over how to actually use the sqlserver connection. Good god!

http://social.technet.microsoft.com/wiki/contents/articles/whitepaper-accessing-sql-server-databases-from-php.aspx

One other thing to note if you’re used to working with .NET or Classic ASP. In PHP the field names are case sensitive.

Written by Tom in: PHP,SQL Server | Tags: ,
Aug
21
2011
0

WordPress on IIS7 can’t install themes or plugins automatically

WordPress has an awesome feature where it can automatically upgrade itself, install themes and plugins, etc. It works fantastically on all apache and lamp installations I’ve played with, but never on Windows with IIS.

I recently upgraded to IIS7 and it was still giving me errors when trying to upgrade, install plugins, etc.

I realized that it just didn’t have write access to the file system so it couldn’t download the new files. To fix this, I added the user IIS_WPG to my wp-content directory with write permissions and immediately it worked. The full step by step went:

1. In file explorer, right click on the wp-content directory. Select Properties.

2. Select the Security Tab.

3. Click Edit.

4. Click Add

5. Type IIS_WPG, click Check Names. It should format it.

6. Uncheck Execute, check, Write and Read.

7. Click Apply.

You’re done!

It should work now.

Written by Tom in: Blogging,Installing Wordpress | Tags: ,

Powered by WordPress | Aeros Theme | TheBuckmaker.com WordPress Themes