Welcome to the nuBuilder Forums!

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

Edit data in temporary table

Questions related to customising nuBuilder Forte with JavaScript or PHP.
Post Reply
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Edit data in temporary table

Unread post by Jannie »

Today I tried to modify data in a temporary table without succes. Maybe somebody can help me?
nuBuilder-Master downloaded 30-1-2021 from github
What I did:
1. I created a browseedit form with php in before_browse I created a new table + one record (just for testing). This (seems to) works fine.
Schermafbeelding 2021-02-02 211553.jpg
2. I clicked on first record --> empty record opened in edit-form

I figured out what happened:
3. I added a nuDebug-line of the sql-query to my before-browse php
4. Deleted all debug-records
After opening form again I see 3 debug-records:
Schermafbeelding 2021-02-02 214622.jpg
first (oldest): SQL-syntax error:
'SELECt * FROM #TABLE_ID# WHERE id2 = '601951e106a343d'' --> #TABLE_ID# is not replaced with my temportarary browse table name + it runs before my 'before browse php' :!:
second:
SQL error 'Table doesn't exist ': Select * From `___nu16019b9e97b815___` Where `id2` = '' --> new tablename is availabley but table doesn't exists + it runs before my 'before browse php' :!:
third: debug of my sql-string in 'before browse php':

Code: Select all

CREATE TABLE ___nu16019b9e97b815___ ( `id2` varchar(25) NOT NULL, `TMP_lezen` varchar(1000) DEFAULT NULL, `TMP_tekst` varchar(1000) DEFAULT NULL, `TMP_thema` varchar(100) DEFAULT NULL, `TMP_punt1` varchar(100) DEFAULT NULL, `TMP_punt2` varchar(100) DEFAULT NULL, `TMP_punt3` varchar(100) DEFAULT NULL, `TMP_punt4` varchar(100) DEFAULT NULL, `TMP_punt5` varchar(100) DEFAULT NULL, `TMP_vrijetekst` text ) ENGINE=MyISAM DEFAULT CHARSET=utf8; INSERT INTO ___nu16019b9e97b815___ (`id2`, `TMP_lezen`, `TMP_tekst`, `TMP_thema`, `TMP_punt1`, `TMP_punt2`, `TMP_punt3`, `TMP_punt4`, `TMP_punt5`, `TMP_vrijetekst`) VALUES ('601951e106a343d', 'read bla', 'tkst', 'thema', 'pt1','pt2', 'pt3', 'pt4', 'pt5', 'kkkkk ')
5. After clicking on the first record again two Debug-error-lines are created: They are nearly the same ase those who where made when I opened browse-form: Only difference is a new temp-table-name in the second one
You do not have the required permissions to view the files attached to this post.
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Edit data in temporary table

Unread post by kev1n »

Hi,

Temporary tables are just used to display data in a Browse Form and is deleted again after it has loaded.
What exactly are you trying to do?
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Edit data in temporary table

Unread post by Jannie »

I tried to modify data in a temporary table during a session because I should like to give my users a easy way to insert data for a html-field in the normal database
I expected that it should be possible to create a temporary table and use it during the whole login-session.

Background:
I have made a nubuilder-database for church-presentations of songs (this works fine!) and want to add the possibility of different kinds of html-based presention text-slides for themes, bible verses etc..
My users must have a easy way to fill in these slides in a form on the website of our church

The idea:
-user chose a slide-type
-I create a temporary table with al needed fields
-User fills records in a easy to edit nubuilder-form
-I combine the input with javascript/php in a html-field of a non-temporary table.
-After user log-off al temporary tables are removed --> no waste
-Same html-field could be used for different slide-types
kev1n
nuBuilder Team
Posts: 4301
Joined: Sun Oct 14, 2018 6:43 pm
Has thanked: 71 times
Been thanked: 445 times
Contact:

Re: Edit data in temporary table

Unread post by kev1n »

Is it necessary to create this temporary table or will a persistent table do?
When logging out (or at regular intervals), this can be emptied again.
apmuthu
Posts: 249
Joined: Sun Dec 06, 2020 6:50 am
Location: Chennai, India, Singapore

Re: Edit data in temporary table

Unread post by apmuthu »

Can it be stored on the fly in an array and then unset when nolonger needed? - Large ones will consume huge memory though.
Jannie
Posts: 33
Joined: Sat Jun 09, 2018 4:36 pm
Location: Netherlands
Has thanked: 4 times
Been thanked: 1 time
Contact:

Re: Edit data in temporary table

Unread post by Jannie »

Thank you @Kevin and @apmuthu! I decided to create persistant tables and remove data weekly after the divine service
Post Reply