[development] CCK lookup and drop-down list

Sean Wingert seanw at norris-stevens.com
Fri Mar 14 21:13:04 UTC 2008


Thanks for the reply, Brad! Just to be sure though, since I don't want to re-invent the wheel if there's a module already, but there isn't a module to do table column lookups, 'programmable' via widgets, instead of code? I need to pass this project onto a non-technician for ongoing support and maintenance, and that person won't understand any PHP code.

Sean


-----Original Message-----
From: development-bounces at drupal.org [mailto:development-bounces at drupal.org] On Behalf Of Brad Bowman
Sent: Friday, March 14, 2008 9:36 AM
To: development at drupal.org
Subject: Re: [development] CCK lookup and drop-down list

Sean,

You can use a CCK select field and define the allowed values using PHP.

Your code would look something like this:

$values = array();
$results = db_query("select id, name from {table}");

while ($result = db_fetch_array($results)) {
   $values[$result['id']] = $result['name']
}

return $values;


Thanks,
Brad
--
Aten Design Group
Phone: 303.831.0449


More information about the development mailing list