Use the database class new_select_query method to create an object of the db_select_query class. This query class implements the creation of a SELECT SQL statement.
The $where parameter is an array with the following elements:
The example below demonstrates how to add a where clause that checks if the 'user_name' field equals the string held in the $username variable.
$query->add_where(array('user_name', '=', DSCORE_DB_STRING_FIELD, $username));