Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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

It will return the formatted result as an array

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top