Dropdown list [message #4473] |
Mon, 18 August 2014 09:21 |
htManager
Messages: 441 Registered: May 2014
|
Senior Member |
|
|
I have a dropdown list in which I want to list entries from a database table. Now I don't know how to change or create the selection criteria.
Can I change the $where criteria in the _cm_getValRep method of the class? If yes, how can I do this?
The first fields of the primary key are the same for both tables. So how can I get these values for using in the selection criteria?
Here is the code:
function _cm_getValRep ($item=null, $where=null)
// get Value/Representation list as an associative array.
{
$array = array();
if ($item == 'ma_mitglieder') {
// get data from the database
$where = $where_mannschaft;
$this->sql_select = 'kontakt_ma_user_id, kontakt_ma_user_seq_no, kontakt_ma_name, kontakt_ma_vorname';
$this->sql_orderby = 'kontakt_ma_name';
$this->sql_ordery_seq = 'asc';
$data = $this->getData($where);
// convert each row into 'id=desc' in the output array
foreach ($data as $row => $rowdata) {
$rowvalues = array_values($rowdata);
$array[$rowvalues[0]] = $rowvalues[0];
} // foreach
return $array;
} // if
return $array;
} // _cm_getValRep
|
|
|