I'm in the process of testing Drupal for my needs, and I'm rather impressed with the simple fact that I can use PHP code in content pages... something few, if any other CMS packages I have used will allow you to do.

ATM I'm simply trying to convert a few scripts from a *nuke flavor for use in Drupal and I need to know how Drupal handles DB queries... simply put, how does the following code snippet translate to Drupal?

$num = $db->sql_numrows($result = $db->sql_query("SELECT * FROM $table WHERE rank='$getrank[$j]' AND status='A' ORDER BY membername "));

Thank you...

Comments

lum12’s picture

I'm totally new in drupal but it's so easy to get what you whant if you use this easy piece of code
http://www.jvmultimedia.com/portal/

ezSQL is done for making simple built code foe db.

put the very few line in the demo in a php condent in drupal and you will get all you need.

bye

luca marletta

Dixen’s picture

@Luca: That's not quite what I was looking for...

However, in general Drupal once again impresses me... It's in the comments of the database.inc! After dealing with other CMSes one would never think to actually check file comments... Wow, just WOW!

I appreciate everyone who took the time to take a look, unfortuantely I didn't get much help with this one. That's currently the only place I find Drupal lacking ATM, poor community supprt on the forums.

vigo-1’s picture

$result = db_query("SELECT * FROM $table WHERE rank='%s' AND status='A' ORDER BY membername", $getrank[$j]);
while($row = db_fetch_object($result))
{
// do something with $row
}