Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Get post from sql database

Hello ,is it possible to add posts, images, lists or any data through sql-database?

1 Answer

SQL is useful for storing any ASCII text wether that's an object, an array, etc.

In regard to images, yes, but do not ever do that. There's no reason to store static files in a database because you're taking a 1MB database hit every time someone requests an image.

Paul Graham , Thank you so much man. But I mean, I have database from sql-server (with .net application) and I want to retrieve some tables from there to my wordpress websitem got my idea ?

WordPress will basically run any PHP code you throw at it, so if you have a library with MSSQL you'd like to use or you want to write vanilla SQL you can retrieve any tables. You can store data in lots of databases with WP, they just aren't supported and there are usually install errors because WP is written with MySQL in mind. If its through a web app, you'd ideally rather fetch data via a JSON or XML API. I think it's far simpler to write a simple API for the .NET app rather than write vanilla SQL and forgo the WordPress API but I'm not that comfortable writing SQL code.

If you're fetching web content and not app-specific data, you might as well be using a simpler app framework like Symfony or Laravel. You can also install WordPress on MSSQL although I don't know of anyone that's doing that.