Before asking, I search the web as best I can and run tests until I simply can't find anything. I have a code, and it works in the sense that it adds the field and I can see it from myphp admin, but it doesn't show up in the application and on top of that, it breaks the web page with an error. I'm pretty sure it's not only rudimentary but that I'm probably not using the right function.
The error: This page isn’t working right now
$prueba=sqlValue("INSERT INTO tareas (cip, nomb1, ape1, detalle, fechaini, comentario, fechafinal, estado, image, minuesti, tipo) SELECT cip, nomb1, ape1, 'My Tarea automatica', DATE_ADD(fechaini, INTERVAL 2 DAY), comentario, fechafinal, estado, image, minuesti, tipo FROM tareas ORDER BY fechaini DESC LIMIT 1;");
Doing baby steps, here, first I need to fully manualy add hard coded record, then the hard code its going to change to another record with some specification
My goal its to learn the best way to add a record via hooks and to it be supported/visible on the appgini app
Hope to hear any help
a3
Insert a record via hook.
Re: Insert a record via hook.
Perhaps you did not set the owner?I can see it from myphp admin, but it doesn't show up in the application
Code: Select all
set_record_owner('TABLENAME', $THE_NEW_PRIMARY_KEY);
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Insert a record via hook.
Thanks! I will check that right away. The function im using its the correct one? Im doing it right?
A3
A3
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Insert a record via hook.
Update: Made it appear, raise one question.
First task is related to the Permission issue, so I went to "Membership_userrecords" and cloned the last working record with PKValue poiting to my tareas.id record.
It worked, but this raises a question, is there a function im missing here? I mean Appgini create records and stuff internaly and I went full(almost) manualy to add a record. Dont think I will need to create two records on two diferent tables to make this work (add a single record)
Still learning but doing my best, thanks for all help im getting.
A3
First task is related to the Permission issue, so I went to "Membership_userrecords" and cloned the last working record with PKValue poiting to my tareas.id record.
It worked, but this raises a question, is there a function im missing here? I mean Appgini create records and stuff internaly and I went full(almost) manualy to add a record. Dont think I will need to create two records on two diferent tables to make this work (add a single record)
Still learning but doing my best, thanks for all help im getting.
A3
Re: Insert a record via hook.
I'm not sure if I got your question completely.
Whenever you create a record in AppGini UI and you leave _after_insert hook returning TRUE, AppGini automatically inserts the membership_userrecord entry. That entry brings the new record under access control.
Whenever YOU create a new record in database, using SQL commands or any other database tool, you will have to create that record. To make it easy, AppGini provides the set_record_owner function I have mentioned above.
Whenever you create a record in AppGini UI and you leave _after_insert hook returning TRUE, AppGini automatically inserts the membership_userrecord entry. That entry brings the new record under access control.
Whenever YOU create a new record in database, using SQL commands or any other database tool, you will have to create that record. To make it easy, AppGini provides the set_record_owner function I have mentioned above.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Insert a record via hook.
Ohh I understand completely now!
Thanks a lot that really helped my understanding!
One last question befere closing this (already answered thread), where can i dig information on all of the Appgini Functions as this one, so I can go and read the manual?
Thanks again!
a3
Thanks a lot that really helped my understanding!
One last question befere closing this (already answered thread), where can i dig information on all of the Appgini Functions as this one, so I can go and read the manual?
Thanks again!
a3
Re: Insert a record via hook.
Well, in the beginning I've taken the UDEMY courses. Now, on every new version, I study the changelog and check out a couple of important PHP files, looking for interesting functions which I might need in the future:
Beyond that, the only thing that helps is reading, comprehending, understanding, trying, making mistakes, finding and improving errors, trying again.
Me, too, in the beginning I had to learn it the hard way when inserting records into tables using SQL commands and not finding the records in UI. At that time I had to check and understand the
Last but not least I'm reading this forum almost every day, trying to understand, learn, answer questions, propose solutions and trying to get better every day.
-
incFunctions.php
-
incCommon.php
AppGini.
and check if there are any new javascript functions in AppGini object.Beyond that, the only thing that helps is reading, comprehending, understanding, trying, making mistakes, finding and improving errors, trying again.
Me, too, in the beginning I had to learn it the hard way when inserting records into tables using SQL commands and not finding the records in UI. At that time I had to check and understand the
membership_*
tables and also read the code which runs especially before, in between and after _before_*
and _after_*
-hooks.Last but not least I'm reading this forum almost every day, trying to understand, learn, answer questions, propose solutions and trying to get better every day.
Kind regards,
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
AppGini 24.10 Revision 1579 + all AppGini Helper tools
<js />
My AppGini Blog:
https://appgini.bizzworxx.de/blog
You can help us helping you:
Please always put code fragments inside
[code]...[/code]
blocks for better readabilityAppGini 24.10 Revision 1579 + all AppGini Helper tools
-
- Veteran Member
- Posts: 104
- Joined: 2018-12-10 21:52
Re: Insert a record via hook.
Thank you a LOT, you just gave me some pieces of info that I know took you a lot of time by yourself, much appreciated!
I will take all that into account.
Aldo
I will take all that into account.
Aldo