Welcome to the nuBuilder Forums!

Register and log in to access exclusive forums and content available only to registered users.

Error moving to second page of browse form

Questions related to customising nuBuilder Forte with JavaScript or PHP.
luca.ongaro
Posts: 64
Joined: Sun Jan 22, 2023 7:03 pm

Error moving to second page of browse form

Unread post 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
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error moving to second page of browse form

Unread post by kev1n »

Hi,

What does the generated SQL look like?
(See Option Menu -> Form Info)
luca.ongaro
Posts: 64
Joined: Sun Jan 22, 2023 7:03 pm

Re: Error moving to second page of browse form

Unread post 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
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error moving to second page of browse form

Unread post 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.
luca.ongaro
Posts: 64
Joined: Sun Jan 22, 2023 7:03 pm

Re: Error moving to second page of browse form

Unread post 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
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error moving to second page of browse form

Unread post 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.
kev1n
nuBuilder Team
Posts: 4292
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 444 times
Contact:

Re: Error moving to second page of browse form

Unread post 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.
luca.ongaro
Posts: 64
Joined: Sun Jan 22, 2023 7:03 pm

Re: Error moving to second page of browse form

Unread post 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
luca.ongaro
Posts: 64
Joined: Sun Jan 22, 2023 7:03 pm

Re: Error moving to second page of browse form

Unread post 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...
luca.ongaro
Posts: 64
Joined: Sun Jan 22, 2023 7:03 pm

Re: Error moving to second page of browse form

Unread post by luca.ongaro »

No, me again. Finally I moved to page #2, but it's empty... :(
Post Reply