在PHP中点击x次后删除图像?

I just need to know how to tell a PHP page via MYSQL database to remove an image after certain amount of clicks?

for example i upload an image via php/mysql (this bit works by the way) and then I need to tell the php to remove that image once there has been 20 or 30 etc etc clicks on it.

any suggestions would be appreciated.

Thanks

You have to record each click on your database:

imageId | image | clicks
1       | ...   | 5
2       | ...   | 10

then you can add a WHERE condition to your SELECT query:

$clicksMax = 20;
$query = 
"SELECT `image`, `imageId`
FROM `image`
WHERE `clicks` < $clicksMax";

Better solution to capture the clicks via ajax request on each click update the coloumn of clicks for the image by adding 1 and when you going to add 1 there you can check the value if it is greater than your desired clicks you will remove that image from html + database also.