Error query after update scriptcase 8 and php8.1

after importing the project in scriptcase 8.01, when starting the application this error is generated:
Fatal error: Uncaught mysqli_sql_exception: 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 ‘WHERE 1 = 0 LIMIT 1’ at line 1 in C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\prod\third\adodb\drivers\adodb-mysqli.inc.php:763 Stack trace: #0 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\prod\third\adodb\drivers\adodb-mysqli.inc.php(763): mysqli_query(Object(mysqli), ‘SELECT * FROM …’, 0) #1 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\prod\third\adodb\adodb.inc.php(1169): ADODB_mysqli->_query(‘SELECT * FROM …’, false) #2 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\prod\third\adodb\adodb.inc.php(1151): ADOConnection->_Execute(‘SELECT * FROM …’, false) #3 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\prod\third\adodb\drivers\adodb-mysqli.inc.php(699): ADOConnection->Execute(‘SELECT * FROM …’, false) #4 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\lib\php\database.inc.php(997): ADODB_mysqli->SelectLimit(‘SELECT * FROM …’, 1) #5 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\compat\nm_select.class.php(499): nm_db_fields(‘conn_mssql_1’, ‘’, ‘C:\Program File…’, 499, Object(ADODB_mysqli), ‘mysqli’, Object(nmConnection), false, true) #6 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\compat\nm_select.class.php(158): nm_select->_PrepareFields() #7 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\nmFontePHPForm.class.php(25579): nm_select->AnalizeSql() #8 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\nmFontePHPForm.class.php(25379): nmFontePHPForm->getWhereLookup(‘SELECT Codice, …’, ‘conn_mssql_1’, ‘%$campo%’) #9 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\nmFontePHPForm.class.php(6274): nmFontePHPForm->nm_gera_fast_search(‘form_apl’) #10 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\nmControleForm.class.php(55): nmFontePHPForm->InicializaDados() #11 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\nmGerador.class.php(2073): nmControleForm->GeraFonte() #12 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\gerador.php(100): nmGerador->IniciaGeracao(‘VM_LINUX’, ‘2’, ‘ins_pegiot’, ‘’) #13 C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\devel\class\generator\gerador.php(2): sg_load(‘68ABBE04C7C5024…’) #14 {main} thrown in C:\Program Files\NetMake\v9-php81\wwwroot\scriptcase\prod\third\adodb\drivers\adodb-mysqli.inc.php on line 763

The original query is in a lookup type field type select and it is the following and it seems that the problem is in the subquery, which with php8.001 and php7.3 works…!

SELECT Codice, Descrizione
FROM Magaz m
WHERE m.FlgInattivo = 0 AND m.TipoMag = 2 AND m.Codice !=
(SELECT g.CodFurgoneVD FROM Generale g
WHERE g.Codice=1)
ORDER BY m.Descrizione

Had the same problem
Go and edit the Database connection and make sure it can connect to the database, Save it and reg generate

Thanks for the reply, but I tried to refresh and save the mysql connections, but it doesn’t work.

Try creating connection with MySQL using PDO. I’ve seen some problems with other devs when using MYSQL LI connection.

1 Like

Ok. using the PDO driver the application works. But this is a scriptcase BUG. I have always used the MySQLi driver and it has always worked. Why can’t I use the MySQLi driver! ?? I kindly ask the scriptcase programmers to fix the BUG.
Thank you.

1 Like

PDO is able to work with different kinds of RDBMS, while MySQLi is made for a specific one. Scriptcase support other kinds of RDBMS so it make sense for them to switch to PDO from MySQLi.

PDO is an library that provides object oriented abstraction for interaction with different database engines (MySQL, PostgreSQL, and so on), so you use only one API to handle all connections. Furthermore, PDO supports prepared statements, which mean that instead of entering all parameters in SQL queries you put only placeholders and then bind proper values when trying to execute query. This prevents or at least makes it really hard to perform SQL injection attack on your application

3 Likes