shuweee Posted June 4, 2005 Share Posted June 4, 2005 hey guys, im sure there's a way to do this but i just cant figure out for the life of me.. any suggestions would be appreciated. how do i go about merging the syntax to include two statements.. PART (A) order by rand() desc limit " . MAX_DISPLAY_NEW_PRODUCTS); PART (B) order by p.products_price desc limit " . MAX_DISPLAY_NEW_PRODUCTS); so my question is, how do i go about having this statement to include those two variables ? e.g order by rand() and p.products_price desc limit " . MAX_DISPLAY_NEW_PRODUCTS); ??? will that work ?? Thanks Link to comment Share on other sites More sharing options...
FalseDawn Posted June 4, 2005 Share Posted June 4, 2005 No, ordering randomly is mutually exclusive to any other ordering clause (otherwise, it wouldn't be random!) If you exaplain a bit more what you are trying to achieve, I'm sure there's a way to do it... Link to comment Share on other sites More sharing options...
shuweee Posted June 4, 2005 Author Share Posted June 4, 2005 No, ordering randomly is mutually exclusive to any other ordering clause (otherwise, it wouldn't be random!)If you exaplain a bit more what you are trying to achieve, I'm sure there's a way to do it... <{POST_SNAPBACK}> im currently trying to figure out how to display slash price on the new_products.php. e.g like a cross on the regular price and display the special price underneth. the reason why im having so much problem is tht i have added buy now feature in the new_products.php so there are a lot of similiar statement and syntaxs. do you know what would be the easist way to acheve that ? Link to comment Share on other sites More sharing options...
FalseDawn Posted June 4, 2005 Share Posted June 4, 2005 I'm guessing that you want a random selection of new products, and you want to order that subset of new products by price DESC, yes? Hmmm - one solution would be to just include the order by rand(), read the results into an array, then use array_sort to sort those results by price. Shouldn't be much overhead for a small array. If you are using PHP 5, it would be easy to write a subquery-type statement (not supported in php 4) to do the same job. Link to comment Share on other sites More sharing options...
shuweee Posted June 4, 2005 Author Share Posted June 4, 2005 I'm guessing that you want a random selection of new products, and you want to order that subset of new products by price DESC, yes? Hmmm - one solution would be to just include the order by rand(), read the results into an array, then use array_sort to sort those results by price. Shouldn't be much overhead for a small array. If you are using PHP 5, it would be easy to write a subquery-type statement (not supported in php 4) to do the same job. <{POST_SNAPBACK}> thanks man, ur the only one that ever replied to me onthis.. im not muh of a php coder so im hoping you can assist me withthis, i could paste the codes here but it would be too big, do you mind helping me have a look at it? thanks Link to comment Share on other sites More sharing options...
FalseDawn Posted June 4, 2005 Share Posted June 4, 2005 You would need to post the code here, really with a full description of what you are trying to do, and the changes you have made so far - I don't usually get involved with writing custom code, sorry! Link to comment Share on other sites More sharing options...
shuweee Posted June 4, 2005 Author Share Posted June 4, 2005 I'm guessing that you want a random selection of new products, and you want to order that subset of new products by price DESC, yes? Hmmm - one solution would be to just include the order by rand(), read the results into an array, then use array_sort to sort those results by price. Shouldn't be much overhead for a small array. If you are using PHP 5, it would be easy to write a subquery-type statement (not supported in php 4) to do the same job. <{POST_SNAPBACK}> i actually want random selection of new products and also display special prices + regular price the contribution is http://www.oscommerce.com/community/contri...ry,11/search,ne Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.