Hi all,
I have a grid with a search area to filter data. The first field of this search area come from the lines of text field.
I got a txt file like the following where are listed the acceptable values for a specific database field (lenght is fixed to 30 chars). More or less 10 rows.
DEPT01
DEPT03
DEPT10
DEPT11
DEPT20
DEPT22
DEPT30
The database field name against where to select those value is i.e. WARDNAME.
Within the select search field I will insert something like that
SELECT WARDNAME FROM TABLENAME
WHERE {WARDNAME} = list of values on the txt file
Could you please suggest how reach this result ??
The reading of txt file has to do every time or it’s sufficient once at the starting of application (OnScriptInit ?? )
Googling I founded this that print the list… in some way:
$file_handle = fopen("…/depts/active_depts.txt", “r”) or die(“Can’t open file-----”);
while (!feof($file_handle) ) {
$line_of_text = fgets($file_handle);
$line = rtrim($line_of_text);
print “’”.$line."’,";
}
fclose($file_handle);
I think to assign the output ‘xxxxx’,‘yyyy’,…‘zzzz’ to a variable [glo_active_depts] and then use it into the select like
SELECT WARDNAME FROM TABLENAME
WHERE {WARDNAME} = [glo_active_depts]
is it correct in your opinion ?? Are there any contreindications ?