phpocean Posted June 13, 2009 Share Posted June 13, 2009 Hello, This code, which is in my page1, upate my hit count by 1 every time the page is viewed. <?php // update hit + 1 mysql_query("UPDATE wallpaper_large SET hit=(hit + 1) WHERE id = '".$Article."'"); ?> Note: Small img colum has the full link to my small img and so does median and large. What I have in my MySQL: I have row with column small img, median img, and large img. Page1 only used median img, but there is a link on page1 to get the large img. What I wanted to achieve: As I stated above, I have the update hit + 1 on that very same page (Page1), but I don't want the update to + 1 to my column when Page1 is viewed, UNLESS the link to large img is clicked. I was thinking maybe I can use "IF" but I don't know where to start. If you have anyway of doing this at all, please let me know. Thanks. ------------------------------- D=P Ocean+Love+PhD Quote Link to comment https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/ Share on other sites More sharing options...
Maq Posted June 13, 2009 Share Posted June 13, 2009 As I stated above, I have the update hit + 1 on that very same page (Page1), but I don't want the update to + 1 to my column when Page1 is viewed, UNLESS the link to large img is clicked. Sorry, I don't understand. I don't think this is a MySQL problem but a logic one. Where is your submissions and logic to handle when this query is executed? Quote Link to comment https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/#findComment-855098 Share on other sites More sharing options...
phpocean Posted June 13, 2009 Author Share Posted June 13, 2009 It seen I made thing harder than it's suppose to be. Lets see if I can explain this a little better. I have my full image path stored in a column in a row, which has other columns such as title and hit and thumbnail full path and description in this same row. I can also create another table and have only the image path stored there and have all other information, such as thumbnail and description stored in another table if needed. On one page, I pulled all the information except for my image path. I also created a link on this page which will download the image because I don't want to show the image on this page due to its large size. All in all, I just wanted a code in which it would add + 1 count to my hit count every time my image is viewed. Quote Link to comment https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/#findComment-855108 Share on other sites More sharing options...
Maq Posted June 13, 2009 Share Posted June 13, 2009 Can you post the relevant code that handles the image being clicked. Quote Link to comment https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/#findComment-855115 Share on other sites More sharing options...
phpocean Posted June 13, 2009 Author Share Posted June 13, 2009 nvm, i got it working. I created two page, one page for the thumb and all the information and another page for just the img itself. When the img page is view, there's a code in there that add count 1 to column but when page with info and thumb viewed, no add 1 to column, tho all the info and image are in one row. It work out so I'm going with that. Quote Link to comment https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/#findComment-855154 Share on other sites More sharing options...
Maq Posted June 14, 2009 Share Posted June 14, 2009 nevermind, i got it working. I created two page, one page for the thumb and all the information and another page for just the img itself. When the img page is view, there's a code in there that add count 1 to column but when page with info and thumb viewed, no add 1 to column, tho all the info and image are in one row. It work out so I'm going with that. That's great to hear. Do you mind posting the final code in case someone else runs into a similar problem. Quote Link to comment https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/#findComment-855363 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.