Jump to content

Link and times clicked


ingvaro

Recommended Posts

Ok, i have a link to another place on my site, and next to that link is a number, that adds 1 each time someone clicks that link, so that i can see how many times that link has been clicked. How can i do this?

The link looks like this
[code]{echo "
<a href=\"gallery/{$row[ 'linkur' ]}/gallery.php\" target=\"_parent\">
<div class=\"gallery_menu\">

<img src=\"gallery/thumbs/{$row[ 'linkur' ]}.jpg\" alt=\"description\" width=\"60\" height=\"60\" border=\"0\" />

<p><strong>
{$row[ 'titill' ]} - {$row[ 'date' ]}
</strong></p>

<p>
{$row[ 'description' ]}
</p>

</div>
</a>
";}[/code]

So i´d like to add in there a number of clicks.

But this "link" which is actually a 800x50 div tag that resembles a picture more than a simple text link, and is created by a table in my database called "galleries", and there are dozens of those links, because they are links to galleries, and the number of galleries right now is more than 40 :)

So on top of that i´d have to make sure that when i press the link to say "gallery1" it would add 1 to a column i would just call "clicks" in the "gallery1" row and not any other row, if you get my point :)

Please help a PHP/MySQL noob :)
Link to comment
Share on other sites

I dont know any specific tutorials but maybe to make it easier on your system I would work on gallery.php and record when some one visits that page and where they are coming from. So eventually you not only will get details of when some one looks to any of your links but also if some one bookmakrs your site and they come back to that specific page.

Could I do it? of course! Could I write a tutorial to do that specific task? maybe :) but if you get the idea there is no need for a tutorial!
Does that help?
Link to comment
Share on other sites

[quote author=fusionpixel link=topic=117798.msg480962#msg480962 date=1165559211]
I dont know any specific tutorials but maybe to make it easier on your system I would work on gallery.php and record when some one visits that page and where they are coming from. So eventually you not only will get details of when some one looks to any of your links but also if some one bookmakrs your site and they come back to that specific page.

Could I do it? of course! Could I write a tutorial to do that specific task? maybe :) but if you get the idea there is no need for a tutorial!
Does that help?
[/quote]

Yeah i could do that, but i think you´re missing my point. Take a look at this site, http://www.pinkbike.com/, you can see parts of articles and then it says Read Article below and in the () it shows how many times that link has been clicked. That is excactly what i want :) is it hard to do?
Link to comment
Share on other sites

Ah! I dont think that I "missed" your point, I think you didn't say you wanted to show how many times people have clicked on your links ;)

It shouldnt be hard to do. For what I see in the code you posted you are pulling information from a database. I would just add a new row to the database that will hold how many times people have clicked on each link. Then it is up to you how you want to track the clicks, you can place the information directly on each form loop like gallery.php?id=5 (or whatever id your link is). Then on the gallery.php page you can grab the id and add 1 more click to your database for that specific link.

Now back to your main page you just add a piece of code like:

{$row[ 'titill' ]} - {$row[ 'date' ]} - 'clicks('. {$row['clicks']}

hows that, better?

Link to comment
Share on other sites

AH! Sorry mate i guess i didn't explain well enough hehe :) But you got it :D

OK i got everything but the id part, what exactly are you talking about there?

[quote]Then it is up to you how you want to track the clicks, you can place the information directly on each form loop like gallery.php?id=5 (or whatever id your link is). Then on the gallery.php page you can grab the id and add 1 more click to your database for that specific link.[/quote]

Sorry im new at all this but im aching to learn new stuff :D so if you could explain that just a bit better that´d be great :D
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.