Question: here is my problem:

I would like to improve an event on my database which give every player 1 point.

That's great but i would like to do it proportionnally so that the players with like 20000 earn 0 points and the player with 10000 earn 50% less than the player with 0.

The formula is already made.

All i need is the for each and i can't do it because i'm not used to the events in phpmyadmin .

The [...] is the part i need help.

It is :

```
[FOR EACH ROW in player SET @id = playerid] 

        SET @points = SELECT points FROM player WHERE playerid = @id
        IF ( @points * 100 / 20000 > 100 )
        THEN 
            SET @earn = 0
        ELSE
            SET @pourcent = @points * 100 / 20000
            SET @pourcentmanque = 100 - @pourcent
            SET @earn = @pourcentmanque * 20 / 30
        END
        UPDATE player SET points = points + @earn WHERE playerid = @id

[END FOR]

```

Thank you for reading me and trying to help.

Answer: 
Here is another solution using multiple "-draw" options:
"-draw" doesn't have a "dissolve" option so you'd need to prepare the
watermark image ahead of time to have 30% alpha.

```
convert watermark.jpg -alpha set -channel alpha -fx .30 watermark30.png
convert originalImage.jpg \
   -gravity NorthWest -draw "image over 3,3 0,0 watermark30.png" \
   -gravity NorthEast -draw "image over 3,3 0,0 watermark30.png" \
   -gravity SouthWest -draw "image over 3,3 0,0 watermark30.png" \
   finalImage.jpg

```

You could combine this with Mark's good recommendation to use the MPR format instead of watermark30.png. I did a couple of "-draw" versus "-composite" timing tests, and it appears that Mark's method is somewhat faster.

---

I hope you don't mind my editing your post - delete it if you wish - but here is how a single command might look that does the same all in one go:

```
convert watermark.jpg -alpha set -channel alpha -fx .30 -write MPR:wm30 +delete original.jpg \
   -gravity NorthWest -draw "image over 3,3 0,0 'MPR:wm30'" \
   -gravity NorthEast -draw "image over 3,3 0,0 'MPR:wm30'" \
   -gravity SouthWest -draw "image over 3,3 0,0 'MPR:wm30'" \
   finalImage.jpg

```

[![enter image description here](https://i.stack.imgur.com/ayWdN.jpg)](https://i.stack.imgur.com/ayWdN.jpg)
Not at a computer, so untested, but this should be close:

```
convert originalImage.jpg \( watermark.jpg -write MPR:wm \) \
   -define compose:args=30,100 -compose dissolve            \
          -gravity NorthWest -geometry +3+3 -composite      \
   MPR:wm -gravity NorthEast -geometry +3+3 -composite      \
   MPR:wm -gravity SouthWest -geometry +3+3 -composite finalImage.jpg

```

MPR is a RAM-based *"Magick Persistent Register"* which I use to avoid needing to keep re-reading the `watermark.jpg`.

The `compose` arguments persist until changed, so I don't repeat them. It may not be necessary to repeat the second and third `-geometry`.