Frage

I just started working on a social network site using elgg framework. I want to do a simple query to the mysql database to get data out of it. How is the best way to connect to the database to do some simple queries on it? Thanks

War es hilfreich?

Lösung

In Elgg, most database interaction is handled through the core database functions. Here's a link to the top level documentation article about the Elgg database system: http://docs.elgg.org/wiki/Engine/DataModel

In general, direct database interaction is discouraged, but if the data you need to access is outside of Elgg's tables, then you would want to look at the functions contained in /engine/lib/database.php. There you will find functions to execute queries, etc.

And of course, since you are in PHP, you can also do standard PHP database calls.

Andere Tipps

You can use the get_data($query) function provided by Elgg.

It will return the formatted result as an array

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top