e1seix Posted November 3, 2007 Share Posted November 3, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/75892-the-update-function/ Share on other sites More sharing options...
e1seix Posted November 3, 2007 Author Share Posted November 3, 2007 $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? Quote Link to comment https://forums.phpfreaks.com/topic/75892-the-update-function/#findComment-384106 Share on other sites More sharing options...
e1seix Posted November 3, 2007 Author Share Posted November 3, 2007 anyone any ideas why this won't register every time the page refreshes? Quote Link to comment https://forums.phpfreaks.com/topic/75892-the-update-function/#findComment-384140 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.