Jump to content

Recommended Posts

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

 

Link to comment
https://forums.phpfreaks.com/topic/162056-solved-update-hit-count-on-click/
Share on other sites

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?

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.

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.

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.  ;)

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.