Man its easy to understand once one sees the block. I just wanted to tell him that such a block in such an extension, exists.
you share the random id with several users
those users then can use the SELECT query to get the shoppoing list they are interested in
Taifun
i think will be "easy" to retrieve data from mysql
but how i can pass to the php scritp a list csv ?
for example i have a list stored in tinydb and i want to share to a second user with listid and insert it in a mysql db!
how i can pass all the insert querys to php script?
INSERT INTO sharelist
(id
, prodotto
, prezzo
, img
, listid
) VALUES ([value-1],[value-2],[value-3],[value-4],[value-5])
for all the rows that i have in tinydb?
supposing i am using <?php/* * Written By: ShivalWolf * Date: 2011/06/03 * Contact: Shivalwol - Pastebin.com
supposed i have a list stored on tinydb i want to write on mysql server the list
and then read!
read function is ok!
i am not able to write data from tinydb to mysql
testmysql.aia (110.2 KB)
you have to prepare the correct INSERT INTO statement in your blocks and send this to the php script
use Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
and concerning the runtime error: first make sure, your SQL statement is correct (use Do it)....
and if it is correct and you still get the error, then the question is, wher exactly in your blocks does the error occur?
Taifun
When i click on writesql button the error occur
As you can see i was using do it and i can see the data of the list
you might want to show us your Do it result of your query
are you able to run any other query like SELECT * FROM sharelist
successfully?
are you using any extension?
Taifun
yes clicking on readsql button i can see data that i added via phpmyadmin on my database!
while on writesql button
i am using your script php
and listview and colintreelistview
well, it does not really help so see only a very tiny part of the Do it result, does it?
what about using your mouse to get that Do it result window larger, copy the result to your clipboard and paste it here into the community, so we can see and verify, if the query is syntactically correct?
the runtime error most probably is coming from the extensions...
my guess is, you are calling them in the Web.GotText event...
as test display your response content in a label and deactivate all other blocks in that event to find out, if you still get the runtime error...
also let me suggest to reconnect the companion app...
Taifun
Do It Result: INSERT INTO sharelist
(prodotto, img, prezzo, listid) VALUES (https://d2f5fuie6vdmie.cloudfront.net/asset/ita/2020/33/354d6cca34c1605d5ebc74c8aa5998b2670924fa.webp Negroni Pancetta Affumicata in Cubetti 2 x 100 g 3.69 €)(https://d2f5fuie6vdmie.cloudfront.net/asset/ita/2022/3/63b1ca27f9aeb20acc010a387be5d8acb63a67ef.webp Conad Piacersi Mortadella di Pollo 1.99 €)(https://d2f5fuie6vdmie.cloudfront.net/asset/ita/2020/33/c13aa87914f13f5ceedf157f8c72e265482630f3.webp Garofalo Penne Ziti Rigate No. 70 Pasta di Gragnano Igp 1.19 €)1);
Do It Result: INSERT INTO sharelist
(prodotto, img, prezzo, listid) VALUES ('(https://d2f5fuie6vdmie.cloudfront.net/asset/ita/2022/3/63b1ca27f9aeb20acc010a387be5d8acb63a67ef.webp Conad Piacersi Mortadella di Pollo 1.99 €)', '(https://d2f5fuie6vdmie.cloudfront.net/asset/ita/2020/32/1ba8d56e7bad660b0e7118c12aba22e7076d6b7d.webp Salzburgmilch Panna Acida 15% Grassi 1.15 €)', '(https://d2f5fuie6vdmie.cloudfront.net/asset/ita/2020/33/354d6cca34c1605d5ebc74c8aa5998b2670924fa.webp Negroni Pancetta Affumicata in Cubetti 2 x 100 g 3.69 €)', '1');
i tryed to add/remove ' and , but insert is always wrong
How do you want the shopping list to be displayed ?
As a text string ?
If yes, tell the format of the text string.
Eg.
Item1Name, Item2Name, Item3Name
Or
Item1Name : Item1Details
Item2Name : Item2Details
Item3Name : Item3Details
i have no problem in display in listview the data that i retrieve from my mysql database
what i want to achieve.. is to store the list of Screen3 that is saved in tinydb into mysql table that has this structure:
Is your main problem Share TinyDB via Whatsapp (Topic name) solved ?
i want to Share it via mysql database...
i store the list in mysql database and share the listid via whatsapp
so other user can retrieve the list clicking on a button that does the query:
select * from sharelist
where listid = 'VALUESHAREDONWHATSAPP'
and put result in listview
while
doing
INSERT INTO sharelist VALUES ('69467579','a', '1.75 €', 'b', '5' , '6', '7' );
i can write data on mysql database!
So the problem is in the join to build the query
see the correct syntax here MySQL Insert Multiple Rows By Practical Examples
there are no commas between the items of one row, there is no comma between each row and what exactly is the last ,'1'
?
Taifun
it's only a test number... Will be the listid to share to other users...
If i use only This block i can write data on my database!
INSERT INTO sharelist
(prodotto
, prezzo
, img
, listid
) VALUES
('product1','prize1','img1','7'),
('product2','prize2','img2','7'),
('product3','prize3','img3','7');
My problem is how to pass the values from the list of tinydb to the insert query!
if i remove ' or , in the query i have the invoke virtual method error!