sc_select onrecord event

hi everybody
when i use sc_select macro and want to fill the form with this onrecord event it fills the form with the last record… there is about 80 record and i want to fill the client id from 1 to 80 but it only writes all records 80

sc_select(my_data, “select clientID from costumers”);
if ({my_data} === false)
{
echo “Access error. Message =”. {my_data_erro};
}
else
{
while (!$my_data->EOF)
{
{clientID} = $my_data->fields[0];
$my_data->MoveNext();
}
$my_data->Close();
}

The on record event triggers for each record that is being displayed.
I dont get what you want here, if you want to display 80 record then put the sql statement in your sql query for the form showing.

The way you do it now is that for each Record the OnRecord will be executed. Thus each record does the while loop. There is no need for that. OnRecord works per record being read.