I have the following problem
I make a query to my database and this is the result: Select iduser,idboton from botones
| iduser | idbuton |
|---|---|
| 1 | 4 |
| 1 | 6 |
| 1 | 8 |
| 1 | 3 |
| 1 | 5 |
| 4 | 8 |
| 4 | 5 |
| 5 | 3 |
| 8 | 1 |
| 8 | 4 |
and i have another table:
| idusers | idbutonactive |
|---|---|
| 1 | 4 |
| 1 | 6 |
| 1 | 12 |
| 1 | 3 |
| 1 | 7 |
| 4 | 4 |
| 4 | 2 |
| 5 | 3 |
| 8 | 7 |
| 8 | 4 |
I want to do an update of the second table according to the data of the first
UPDATE botones SET idboton=concat('9999',idboton) where idboton not in(4,6,8,3,5) and idusers not in(1,1,1,1,1)
Is it possible to go through the first table and save the data in two variables?
EXAMPLE: $one[]=(4,6,8,3,5) $two[]=(1,1,1,1,1)
UPDATE botones SET idboton=concat('9999',idboton) where idboton not in($one) and idusers not in($two)
and so with each iduser
some help?