Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.