rstewart
rstewart

Reputation: 465

elgg database connection

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

Upvotes: 1

Views: 1386

Answers (2)

gauthamp
gauthamp

Reputation: 1

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

It will return the formatted result as an array

Upvotes: 0

Mike Hedman
Mike Hedman

Reputation: 1441

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.

Upvotes: 2

Related Questions