Jump to content

rand() result but to exclude current id


remybink

Recommended Posts

On the side menu I would like to use my rand() function, but the side menu is just extra products, the main part of the page has a product which i do not want in the side menu rand() function

 

so, does the $_GET['id'] come to play here too?

also, i am calling "select..... and mysql_query twice on this page, once for main part of page and second for side menu, i dont know if it can be merged, but for my sanity i prefer to keep them separate. plus it allows me to add this menu in other pages easier.

 

I would like to try it myself first if someone can give me a hint --

 

$records = "SELECT * FROM (items) ORDER BY RAND() LIMIT 3";  

 

Link to comment
https://forums.phpfreaks.com/topic/243128-rand-result-but-to-exclude-current-id/
Share on other sites

Thank you very much.

The pointer on speed of rand() is appreciated.

 

This db will be just for my very small business.

I won't have more than 100 products between all categories. But it's great advice while I learn PHP/MySQL

I wish I was strong in it like I am in CSS  -- thanks again

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.