DB Forms in DRUPAL

Hi, I found this part of code is very useful for adding custom forms in Drupal.   <?phpfunction booksearch_form() {    $output .= drupal_get_form(‘booksearch_my_form’);    $output .= booksearch_query();    return $output;} function booksearch_query() {     $sql = “SELECT * FROM bookshelf”; //your uber cool query goes here        db_set_active(‘booksearch’); //my separate db connection specified in modified settings.php    $result […]