SQL query for an entry where the current date is in the start / end dates


Using MySQL

The two fields I need to compare the current date to are: startDate, endDate

I need a query something like this:

SELECT * FROM `{$this->_sPrefix}`
WHERE `profileID` = '{$iProfileId}'
BETWEEN `startDate` AND `endDate`
ORDER BY `added` DESC";

This is my new query but I don't know how to do both checks: profileID and the date together.

You should be able to do that, but you have to use BETWEEN:

 WHERE CUR_DATE() BETWEEN `startDate` AND `endDate`

What SQL database are you using?

Edit (in response to edited question, and please don't keep changing the question!):

Your query looks correct, assuming that profileID, startDate, and endDate are all columns in the same table.

Also, if this is a web-facing application, please consider avoiding this kind of dynamic SQL generation as it makes your application open to SQL injection attacks.