Skip to content

Use table to search and select row for edit #151

Answered by lovasoa
lozdown asked this question in Q&A
Discussion options

You must be logged in to vote

Hello and welcome to SQLPage !

The easiest way to achieve what you want to do is to add an "edit" column to your table with a link to your edition page. Like so:

select 'table' as component, 'action' as markdown;
select *, format('[Edit](edit.sql?id=%s)', id) as action from users;

Then, in edit.sql, you can have your form:

select 'form' as component;
select 'text' as type, 'Username' as name, username as value from users where id = $id;

update users set username = :Username where id = $id and :Username is not null;

See the simple website example

table.sql edit.sql

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lozdown
Comment options

Answer selected by lozdown
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants