Dbal.sql query

dbal::sql_query –– Run an SQL Query

Description
For selecting basic data from the database, the function sql_query is enough. If you want to use any variable in your query, you should use (If it isn't a integer) dbal::sql_escape to be sure the data is safe. Defined in dbal_* class.
 * 1) resource dbal::sql_query ( string $query, int $cache_ttl )

Return Values
Returns a result object or FALSE on failure.

The returned result resource should be passed to $db->sql_fetchrow, $db->sql_fetchrowset or other functions for dealing with result tables, to access the returned data.

Example #1
Basic usage. $integer = 0; $data = "This is ' some data";

$sql = 'SELECT * FROM '. POSTS_TABLE. ' 	WHERE post_id = '. (int) $integer. " 		AND post_text = '". $db->sql_escape($data). "'"; $result = $db->sql_query($sql);