Basically I want to run this query against the current database and retrieve all node titles with node type of foo_type.
SELECT title FROM node WHERE type='foo_type' ORDER BY title ASC
How can I do this using db_query or any similar function? I tried doing the below but $result is empty.
$result = db_query("SELECT title FROM node WHERE type='foo_type' ORDER BY title ASC");
Please note any D6 and D7 differences if there are any.