Hi,

function xyz()
{
<a href="<?=$rame['img_link']; ?>"  ><img src="img/<?=$rame['preview']; ?>" width="<?=$w;?>" height="<?=$h;?>" alt="<?=$rame['name']; ?>" /></a>
}

Using function I get image and url
suppose image->url=http://www.daniweb.com

I want to do like...
when user click on this image i want to save count(hit) into database(mysql)

How to do this...??

Recommended Answers

All 3 Replies

In the script (the url), check if the user is a unique user (by checking his IP address). If he is a unique user, update count. :-/ You can't call a javascript event (onclick) to update the table. You can try the same with Ajax though.
ie., Onclick, call the ajax function, check the user's IP and then update the table if he is a unique user.

Hi nav33n,

Can you give me sample example how to do this using Ajax??

Sorry! I don't have a sample example. But this example is the closest I could find.
http://www.w3schools.com/php/php_ajax_suggest.asp
In the example, onkeyup event is used, which calls the ajax function whenever a key is pressed (and give suggestions). Instead, you can have onclick event, which will call the ajax function, which checks the user's IP and update the count.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.