However..
My client says that it isn't updating according to popular product.
Is this right? See wa_settings.name = 'Featured Product'
<?php
mysql_select_db($database_PowerStoreConnection, $PowerStoreConnection);
$query_MostPopularRS = "SELECT * from ps4_products where ps4_products.ProductLive = 1 and ps4_products.ProductID <> (select wa_settings.value AS SettingValue from wa_settings where wa_settings.name = 'Featured Product') order by (select coalesce(sum(ps4_orderdetails.DetailQuantity),0) from (ps4_orderdetails join ps4_orders on((ps4_orders.OrderID = ps4_orderdetails.DetailOrderID))) where (ps4_orderdetails.DetailProductID = ps4_products.ProductID)) desc limit 1";
$MostPopularRS = mysql_query($query_MostPopularRS, $PowerStoreConnection) or die(mysql_error());
$row_MostPopularRS = mysql_fetch_assoc($MostPopularRS);
$totalRows_MostPopularRS = mysql_num_rows($MostPopularRS);
?>