Hi there,

I am trying to fetch some results from the drupal database with this code in a panel, using the "new custom code" option within pages.

$result = mysql_query("SELECT renner,groen FROM `custom_content_type_alg_klassement` GROUP BY renner ORDER BY groen DESC LIMIT 3");
while ($row = mysql_fetch_array($result)) { 
}
Renner Sprint Pnt
print $row[0] print $row[1]
mysql_close();

In the preview pane, I dont' receive any errors. But accessing the page, after adding an URL alias, I get tons of error lines saying:

warning: mysql_get_server_info() [function.mysql-get-server-info]: Access denied for user 'apache'@'localhost' (using password: NO) in /home/twce/domains/twce.nl/public_html/includes/database.mysql.inc on line 44.

What's the correct way to connect to the drupal database?

thanks!

Comments

merlinofchaos’s picture

Status: Active » Fixed

Documentation is a blessed thing:

http://api.drupal.org/api/group/database/6

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.