I need to connect to mysql database and select some records in Drupal 7. How can I do it from within Drupal 7.
I tried this code, but it doesn't work:
db_set_active('default');
$sql = mysql_query("SELECT * FROM users");
while($result = mysql_fetch_array($sql)) {
echo $result["uid"];
echo $result["name"];
Any ideas?