Page 1 of 2

Error moving to second page of browse form

Posted: Sat Apr 15, 2023 6:34 pm
by luca.ongaro
Hi, I followed this thread (viewtopic.php?t=9953) and everything goes smooth.
I retrieve many records (as expected in my case), but when I move to the second page using the bottom arrow, this is what I get:

Code: Select all

Before Browse of Form Operazioni

/var/www/html/nuBuilder-4.5-master/core/nucommon.php(1406) : eval()'d code
syntax error, unexpected 'BY' (T_STRING)

Traced from...

(line:84) /var/www/html/nuBuilder-4.5-master/core/nuapi.php - nuGetFormObject

(line:460) /var/www/html/nuBuilder-4.5-master/core/nuform.php - nuBrowseColumns

(line:1133) /var/www/html/nuBuilder-4.5-master/core/nuform.php - nuBeforeBrowse

(line:21) /var/www/html/nuBuilder-4.5-master/core/nuform.php - nuEval
and in the Debug results:

Code: Select all

[0] : ===PDO MESSAGE===

SQLSTATE[42S02]: Base table or view not found: 1146 Table 'nuBuild.___nu1643ad10a6c648___' doesn't exist
Any hint? Thanks

Re: Error moving to second page of browse form

Posted: Sat Apr 15, 2023 6:48 pm
by kev1n
Hi,

What does the generated SQL look like?
(See Option Menu -> Form Info)

Re: Error moving to second page of browse form

Posted: Sat Apr 15, 2023 7:00 pm
by luca.ongaro
I must send you a screenshot, as clicking on the 'Copy SQL ' button returns the same PDO message that I pasted above.
Clipboard01.jpg

Re: Error moving to second page of browse form

Posted: Sat Apr 15, 2023 7:11 pm
by kev1n
I believe the invalid SQL is already generated in PHP BE.
Are you using an "Order By" Clause?

Can you add a

Code: Select all

nuDebug($sql);


(Replace $sql with the name of the variable that contains the sql)

before the line nuRunQuery()?

Then check nuDebug Results and post the output here.

Re: Error moving to second page of browse form

Posted: Sat Apr 15, 2023 7:38 pm
by luca.ongaro
Here it is.
Forgive me for the ugly field names, as I am just exploring the possibility of getting rid of an old messy Access DB...

Code: Select all

CREATE TABLE ___nu1643ae065dd0e9___ 
SELECT
 tbloperazioni.*,
    tblFornitori.*

FROM
    tbloperazioni
        JOIN tblFornitori ON tbloperazioni.id_beneficiario = tblFornitori.fornitori_id

WHERE
    ((data_pagamento >= '2023-01-01')) AND ((data_pagamento <= '2023-12-31')) AND 
 ((in_uso = 1))

ORDER BY doc

Re: Error moving to second page of browse form

Posted: Sat Apr 15, 2023 7:53 pm
by kev1n
Thank you very much. I'll try to replicate it. As I have limited internet access at the moment, it may take some time.

Re: Error moving to second page of browse form

Posted: Sun Apr 16, 2023 6:23 am
by kev1n
I attempted to reproduce the problem but was unsuccessful. In order to better assist you in identifying the root cause of the issue, could you please provide the complete PHP code of the BB event, along with your Browse SQL? Additionally, sharing the table schema, including the columns and their respective data types, would be beneficial.

Re: Error moving to second page of browse form

Posted: Sun Apr 16, 2023 7:56 am
by luca.ongaro
Here is the full PHP BB code

Code: Select all

$s = "
CREATE TABLE #TABLE_ID# 
SELECT
 tbloperazioni.*,
    tblFornitori.*

FROM
    tbloperazioni
        JOIN tblFornitori ON tbloperazioni.id_beneficiario = tblFornitori.fornitori_id

WHERE
    ((data_pagamento >= '" . #my_anno# . "-01-01')) AND ((data_pagamento <= '" . #my_anno# . "-12-31')) AND 
 ((in_uso = 1))

ORDER BY doc
";
nuDebug($s);
nuRunQuery($s);
and the Browse SQL.

Code: Select all

SELECT * FROM #TABLE_ID#;
Thank you, have a good Sunday

Re: Error moving to second page of browse form

Posted: Sun Apr 16, 2023 8:08 am
by luca.ongaro
UPDATE
I think I found the root problem. My code is infilled with invisible characters of non-breaking spaces!
Now I have to understand how they are generated, probably copy-and-paste from different sources...

Re: Error moving to second page of browse form

Posted: Sun Apr 16, 2023 8:16 am
by luca.ongaro
No, me again. Finally I moved to page #2, but it's empty... :(