Problem with use of variable form fields #1000
Answered
by
DSMejantel
DSMejantel
asked this question in
Q&A
-
Hi, I stay on a white page ! How can i do ? --Insertion dans la base
DELETE FROM livret where prestation_id=$prestation and classe_id=$classe_select
INSERT INTO livret(prestation_id, jour, service_id, classe_id, tarif, present, eleve_id, parent_id)
SELECT
$prestation as prestation_id,
(SELECT strftime('%m/%Y',jour) FROM prestation WHERE id=$prestation) as jour,
(SELECT service_id FROM prestation WHERE id=$prestation) as service_id,
$classe_select as classe_id,
(SELECT tarif from prestation WHERE prestation.id=$prestation) as tarif,
CAST(value AS INTEGER)as present,
CAST(key AS INTEGER) as eleve_id,
(SELECT parent_id FROM eleves WHERE eleves.id=CAST(key AS INTEGER)) as parent_id
FROM JSON_EACH(sqlpage.variables('post'))
RETURNING
'redirect' AS component,
'/saisie_tableau.sql?prestation='||$prestation AS link; ![]() |
Beta Was this translation helpful? Give feedback.
Answered by
DSMejantel
Aug 26, 2025
Replies: 1 comment 1 reply
-
You don't need the returning anyway ! RETURNING is useful when you need autogenerated values from the rows you just inserted. In your case, just use a plain select. INSERT [...] FROM JSON_EACH(sqlpage.variables('post'));
SELECT
'redirect' AS component,
'/saisie_tableau.sql?prestation='||$prestation AS link; |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks !