Jarlo Posted January 21, 2009 Share Posted January 21, 2009 I am DESPERATE! I have been searching for hours, and I need someone's help. I have a page with thumbnail images. I have a click counter set up already, but I need to know how to display the images that were clicked the most. Any help would be greatly appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/141705-most-viewed-scriptcodetutorial/ Share on other sites More sharing options...
RussellReal Posted January 21, 2009 Share Posted January 21, 2009 can you give us your mysql table of the click counter.. or, atleast describe your method for counting the clicks either way the method of returning the "Most Viewed" image.. would be simple if in mysql SELECT `image_src`,`image_id` FROM `images` ORDER BY `image_clicks` DESC LIMIT 1 Quote Link to comment https://forums.phpfreaks.com/topic/141705-most-viewed-scriptcodetutorial/#findComment-741840 Share on other sites More sharing options...
Jarlo Posted January 21, 2009 Author Share Posted January 21, 2009 I should have added that I'm a total newb when it comes to php. I downloaded something called "ccount" and am using that as a click counter. I couldn't figure it out via MySQL. Do you think you could walk me through it using MySQL? My site is www.designsbybarlow.com if that helps. Quote Link to comment https://forums.phpfreaks.com/topic/141705-most-viewed-scriptcodetutorial/#findComment-741844 Share on other sites More sharing options...
RussellReal Posted January 21, 2009 Share Posted January 21, 2009 ok.. create a landing page for all of the images.. then echo the content of the image inside the php file.. example image.php?file=whatever.jpg then inside of image.php do something like <?php $file = "images/".$_GET['file']; // here record it as a click for $file in mysql $e = getimagesize($file); header("content-type: {$e['mime']}"); readfile($file); ?> Quote Link to comment https://forums.phpfreaks.com/topic/141705-most-viewed-scriptcodetutorial/#findComment-741866 Share on other sites More sharing options...
Jarlo Posted January 23, 2009 Author Share Posted January 23, 2009 I apologize, but I don't understand any of that. Quote Link to comment https://forums.phpfreaks.com/topic/141705-most-viewed-scriptcodetutorial/#findComment-743904 Share on other sites More sharing options...
landavia Posted January 23, 2009 Share Posted January 23, 2009 omg... this request need more than 1 script.. u need 2 script to have what u need in global.. 1. u need 2 table a. table contain image => build yourself but have picid b. table named pic_counter=> contain picid & picclick this pic/image table must seperated.. don't ever try to put together.. and DON't make same mistake like i do *and don't ask what is it.. that's something related to corrupt table 2. let's say when you want to see 1 image.. he/she must click mypic.php?id=1 plz add time after id. reason.. to avoid someone steal ur image and put on his/her site; to expire your image. you image today have expire until ... (put on time).. without time.. he will show blank img 3. inside mypic.php contain 3 modules.. more the better a. view if the time already expire or not b. if everything goes wrong.. show bad img.. but if not.. query table pic_counter to add 1 c. show the image sry.. i was work here.. and there a lot user need my/our help Quote Link to comment https://forums.phpfreaks.com/topic/141705-most-viewed-scriptcodetutorial/#findComment-743954 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.