How to put control form find in set results in a string

hi there,

so i have this code

SELECT
project_opleidingen.op_klascode
FROM
project_opleidingen,
ILP_rooster_TEMP
WHERE
FIND_IN_SET(project_opleidingen.op_crebo,ILP_rooster_TEMP.wk_ex_mail_1) AND
(ILP_rooster_TEMP.wk_id = ‘1779’) // replace 1779 for $op_crebo
ORDER BY
project_opleidingen.op_klascode, project_opleidingen.op_crebo

gives me back a nice pair of records, all fine

Now i wan’t to do the same in a control form where i put the values in a string

i used the explode in combination with for_each but i can’t get the result right everytime i get one result per item in the strin

i wan’t to look up the value in a string, (ILP_rooster_TEMP.wk_ex_mail_1)
compare it with another field in another table (project_opleidingen.op_crebo)
and give the values back ( project_opleidingen.op_klascode) that corrspond and put them in a string.

i use this code, see the values from $rs and their fine, but i can’t get the value in a comma separeated string

$wk_id = 1779;

/**

  • Selecting a field from another table
    */

// Check for record
$check_sql = “SELECT wk_ex_mail_1”
. " FROM ILP_rooster_TEMP"
. " WHERE wk_ex_tel_1 = ‘" . $wk_id . "’"; // wk_id uit de bak
sc_lookup(rs, $check_sql);

if (isset({rs[0][0]})) // Row found
{
$wk_crebo = {rs[0][0]};

}
else // No row found
{

}

// sets the field with the array (double select) om in string
$crebo_totaal = (explode(’,’,$wk_crebo));

foreach ($crebo_totaal as $crebo_code)

{

// Check for record
$check_sql = ‘SELECT op_id’
. ’ FROM project_opleidingen’
. " WHERE op_crebo = ‘" . $crebo_code . "’";

sc_select(rs, $check_sql);

//initialize the field
{klascode} = 0;
if (false == {rs}) // Error while accessing database
{
sc_error_message(‘Error while accessing database.’);
}
else
{
while(!$rs->EOF)
{
{klascode} += $rs->fields[0];
echo $rs;
$rs->MoveNext();
}
$rs->Close();
}

//$result[] = {klascode};

}

//
//$mystring1 = implode(",",$result);

any ideas?