Search code examples
elgg

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


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.