I have two concerns with the castracker_options_select function. First, there is no table prefixing possible (easy fix, just make it {%s}). Second, it looks to me like it selects all from whatever table gets passed in by the $table variable. One of the calls to this function gets the list of projects that a case can belong to. It passes term_data in as the table. That means that in order to build a select box with all the projects in it, the entire term_data table is being selected and iterated over. Or am I misreading this?
/**
* Function to get the option values for form select box
*/
function casetracker_options_select($table, $value_field, $disp_field) {
$result = db_query("SELECT * FROM %s", $table);
$options = Array();
while ($row = db_fetch_array($result)) {
$options[$row[$value_field]] = $row[$disp_field];
}
if ($table == 'users') {
unset($options[0]);
}
return $options;
}
Comments
Comment #1
sanjeev gupta commentedNo Robert you are correct.I have updated the function castracker_options_select.Now when there is is a fetching of data from the {term_data} data I have imposed the condition that the term data should belong to a particular category
It is basically a modular function and has its limitation and I intend to use this function for this specific module.
Comment #2
sanjeev gupta commentedNo Robert you are correct.I have updated the function castracker_options_select.Now when there is is a fetching of data from the {term_data} data I have imposed the condition that the term data should belong to a particular category
It is basically a modular function and has its limitation and I intend to use this function for this specific module.
Comment #3
(not verified) commented