Jump to content

[SOLVED] UPDATE function query


e1seix

Recommended Posts

$p1=$row[pop];
$p2=1;
$pop=($p1+$p2);

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

 

what's wrong with this code?

 

the idea is that when a page loads on my website with the corresponding sku, the corresponding SET "pop" gets updated by 1

 

ie. the point is to show me which of my product sku's is most viewed by clients so i can base a top selling products page on. i did post this earlier today and now i can't find the topic at all to rehash it.

 

anyway, any help would be appreciated. I'm more familiar with SELECT as oposed to UPDATE.

 

what i have initially works and updates all products with "0" views to "1", but if the same page is revisited or refreshed it stays at "1".

 

many thanks,

Link to comment
https://forums.phpfreaks.com/topic/75952-solved-update-function-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.