Jump to content

Recommended Posts

I have a bit of a question. It's more or less to see if this is possible. I have only ever really used the SELECT function of PHP.

 

I have a large product site and I'm trying to think of a way to log the pages on my site that get the most clicks. Yes, I could technically use my host to do this but I'm wondering if you think this is feasbible.

 

Aswell as productName, productDescription, productPrice etc. in mySQL if I had another tag (I'm terrible with terminology!) called "popularity" and if I could somehow use the UPDATE function, so that every time a particular product page was loaded it would update its corresponding "popularity" value by 1, I could then go into phpAdmin and view which products had the highest "popularity" value and also use ORDER BY popularity to display what products were currently front runners in a top sellers page...

 

Would that work in peoples' opinions? And what way would you go about using the UPDATE function to do this... an 'if' statement?

Link to comment
https://forums.phpfreaks.com/topic/75892-the-update-function/
Share on other sites

$pop=$row[pop];
$p=1;
$popp=($pop+$p);

mysql_query("UPDATE fragrances SET pop = '$popp'
WHERE sku=$sku");

 

OK so i have gotten this far as yes - it appears to work, but only once. ie. it has updated the pages pages i have looked at to "1" instead of "0." but it won't load any of the "1's" to "2's" if i go refresh the page.

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/75892-the-update-function/#findComment-384106
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.