sql error in form->sql that cannot be found

I run v9.3.003 on a linux System
My License: [B]B111S111S114CVVI
The Problem occurs in multiline form

The structure of the table ibn_classes :
curso int 11
solicitud int 11
param_a

the primary key is curso & solicitud for each line

There is a second table ibn_solicitudes:
solicitud_id int 11 primary key
ano_bloque int 11
grado_estudio int 11
param sol1
…[/B]
The sql statement of the form application
[B]SELECT curso,solicitud,param_a, …
FROM ibn_classes
WHERE
curso=[curso] AND
solicitud IN (SELECT solicitud_id
FROM ibn_solicitudes
WHERE ano_bloque=[anoBloque] AND grado_estudio=[gradoEstudio])

[curso], [anoBloque]. [gradoEstudio] are session variables that are set before.

When I run this in my development system I receive an error:[/B]

1064: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM ibn_classes WHERE curso=8 AND solicitud IN (SELECT solicitud_id ’ at line 1
ADOConnection._Execute(SELECT count() AS countTest from ibn_classes where FROM ibn_classes WHERE curso=8 AND solicitud IN (SELECT solicitud_id…, false) % line 1149, file: adodb.inc.phpADOConnection.Execute(SELECT count() AS countTest from ibn_classes where FROM ibn_classes WHERE curso=8 AND solicitud IN (SELECT solicitud_id…) % line 4373, file: form_ibn_classes_1_apl.phpform_ibn_classes_1_apl.nm_select_banco() % line 1507, file: form_ibn_classes_1_apl.phpform_ibn_classes_1_apl.controle() % line 2009, file: index.php [TABLE=“align: center”]
[TR]
[TD=“align: left”] [TABLE]
[TR]
[TD] Error[/TD]
[TD]Cerrar[/TD]
[/TR]
[/TABLE]
[/TD]
[/TR]
[TR]
[TD=“align: center”]Se produjo un error al acceder a la base de datos
You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'FROM ibn_classesWHERE curso=8 AND solicitud IN (SELECT solicitud_id ’ at line 1

		View SQL

Script: /opt/NetMake/v9/wwwroot/scriptcase/app/schoolAdmin3/form_ibn_classes_1/form_ibn_classes_1_apl.php (4376)

		Running the above Select statment in Database Builder->SQL Kommando I get the proper result from the database without any error.

[LEFT]Could anybody help me in finding the problem?[/LEFT]
[/TD]
[/TR]
[/TABLE]

Scriptcase concantinates the variables in the sql statements quite differently than what would normally work elsewhere. I’ve run into similar messages in the past. I’ve found that using their built in sql builder tool to build the statements, especially when having special parameters like yours, is the best way to get the proper statement for what their software reads. Plus it allows you to test the code and tweak it before using it.

Actually, the solution to the above problem is simple: <Using the same name for global variables and for db field names has been the reason for the above error behaviour. Scriptcase states somewhere that this should be avoided. But who thinks of it when faced with a clearly wrong function.