Thanks so much! Your suggestion worked. I'm still a little confused, though. Please indulge my curiosity.
I am using the db_select_all() function in another place, and it DOES return the array $tabledata. When I commented out the global declaration, the data disappeared from that place.
ex:
vendors_db_login();
$vtable='mydatabasetable';
$vsort='vendor_name';
$vsortdir='ASC';
db_select_all($vtable,$vsort,$vsortdir);
$form_build['vendor']=$tabledata;
this does put the $tabledata array into $form_build['vendor'].
Doing this all in-line was my workaround since it didn't work when I wrapped it in a function declaration like so:
function db_vendor_list($sortparam,$sortdir){
global $vendorlist;
require_once('db_logins.php');
vendors_db_login();
$vtable='mydatabasetable';
$vsort=$sortparam;
$vsortdir=$sortdir;
db_select_all($vtable,$vsort,$vsortdir);
$vendorlist=$tabledata;
return $vendorlist;
}
To my eye, the function does exactly the same thing as the non-function, but $vendorlist is empty while $form_build['vendor'] is populated.
Can you explain why that is?
(I now see that db_vendor_list() also works when I've commented out the global $tabledata declaration) I just don't see why.