list($usec, $sec) = explode(' ', microtime());
srand( (float) $sec + ((float) $usec * 100000) );
$mtm= rand();
if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { // in index.php
$new_products_query = db_query("select p.products_id, p.fr_currencies_id, p.products_list_price, p.products_model, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added, rand() DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);
Hello, this is my first title.
i have a box, which shows 10 new products, but i add mostly 40 products.
i want to select 10 random products from last added 40 products.
* "by p.products_date_added, rand()" gets all the products from the table regardless the last added.
what i must do?