Page 1 of 1

Edit data in temporary table

Posted: Tue Feb 02, 2021 10:15 pm
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

Re: Edit data in temporary table

Posted: Wed Feb 03, 2021 5:35 am
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?

Re: Edit data in temporary table

Posted: Thu Feb 04, 2021 11:13 pm
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

Re: Edit data in temporary table

Posted: Fri Feb 05, 2021 3:58 am
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.

Re: Edit data in temporary table

Posted: Sat Feb 06, 2021 2:54 am
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.

Re: Edit data in temporary table

Posted: Thu Feb 11, 2021 8:00 pm
by Jannie
Thank you @Kevin and @apmuthu! I decided to create persistant tables and remove data weekly after the divine service