Reputation: 3
I would like to make a request like this one:
DELETE * FROM '" . $my_table . "'
WHERE 1 AND '--my first column--' = '" . $my_id . "';
The main idea is to delete, no matter what the first column's name of my table is, every rows is like my value, unspecifying the column name.
In CSS I would write:
WHERE column:nth-child(0) = $my_id
Do you know if this is possible? And how it works?
Upvotes: 0
Views: 45
Reputation: 11734
First run:
DESC `table`;
Then use the column name retrieved in the DESC in your DELETE.
DELETE FROM `table` WHERE `column-name` = value;
Upvotes: 2