ingvaro Posted December 8, 2006 Share Posted December 8, 2006 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 :) Quote Link to comment Share on other sites More sharing options...
btherl Posted December 8, 2006 Share Posted December 8, 2006 You can store the number of times clicked in mysql, or in a text file. How to do either of those is best answered by a tutorial. Quote Link to comment Share on other sites More sharing options...
ingvaro Posted December 8, 2006 Author Share Posted December 8, 2006 You know any good tutorials? :) Quote Link to comment Share on other sites More sharing options...
ingvaro Posted December 8, 2006 Author Share Posted December 8, 2006 Bump :( Quote Link to comment Share on other sites More sharing options...
fusionpixel Posted December 8, 2006 Share Posted December 8, 2006 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 Link to comment Share on other sites More sharing options...
ingvaro Posted December 8, 2006 Author Share Posted December 8, 2006 [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? Quote Link to comment Share on other sites More sharing options...
fusionpixel Posted December 8, 2006 Share Posted December 8, 2006 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? Quote Link to comment Share on other sites More sharing options...
ingvaro Posted December 8, 2006 Author Share Posted December 8, 2006 AH! Sorry mate i guess i didn't explain well enough hehe :) But you got it :DOK 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.