Thank you very much for looking at it.
$findlastid = mysql_query("SELECT id FROM business ORDER BY id DESC LIMIT 1");
It is too big of a table. This first line was recommended by many for a big table because it takes a much shorter time for the code to find the last id row, then to search through a whole lot of them to get the total number of rows in the table instead. Why finding that last id was done that way.
mysql_query("SELECT id FROM business WHERE id>=1 ORDER BY $rand LIMIT 5")OR die(': ' . mysql_error());
I know something is wrong with the last query why I was trying to get help to figure out where the hitch is. Are you sure is it is in calling $rand like that though because many recommeded using it that way. MANY said use something similar to that instead of rand() there are all sorts of saying just that in searches as well, under one of the links I gave in this, and others 'don't use rand()' etc.
When you mentioned order by $rand, doesn't seems like it is saying, order by 42. To others it was reading order things by whatever $rand says to do so order by things 'randomly'. Do the number randomly order by the rows being pulled random and randomly. Order things by whatever $rand wants don't think is anything uncommon see it done all the time a $rand variable of some kind used instead of rand() because of these type of situations and others. And also using other random variables instead of rand() is a very common thing done.
The $rand is working it's just picking the random row to show 5 after it.
So the question is how to also make those 5 picked to display randomly as well.
So I don't know if the words 'order by' is what the hitch is I thought someone else would know I couldn't find it. Maybe 'order by' shouldn't be used right before $rand in this query. Or something else is wrong with this last query no one has spotted yet
mysql_query("SELECT id FROM business WHERE id>=1 ORDER BY $rand LIMIT 5")OR die(': ' . mysql_error());
I've looked at it a 100 times and can't spot it. Here's following how it still all is now:
if(!isset($COOKIE["a"])){//Check if cookie set, if not set to 1.
setcookie("a", 1, time()+606024*730);}
if(isset($COOKIE["a"])){
$a=$_COOKIE["a"];}
$findlastid = mysql_query("SELECT id FROM business ORDER BY id DESC LIMIT 1");
$lastid = mysql_result($findlastid,1);
$rand = mt_rand(1,$lastid);
mysql_query("SELECT id FROM business WHERE id>=1 ORDER BY $rand LIMIT 5")OR die(': ' . mysql_error());
This returns 5 id rows at a time 3,4,5,6,7,8, or 13,14,15,16,17 etc. on each refresh.
I need to know how to mix up 'the' 5 rows at a time randomly?
So instead the 5 rows at a time could be any id rows taken that are all random instead. Like 19, 2, 9, 14, 7 etc. instead. If it's the order by, I don't know how to remove that to write it right, or something else. Please let me know thank you.
The $rand is working it's just picking the random row to show 5 after it.
So the question is how to also make those 5 picked to display randomly as well.
The first rand worked, how to make those 5 numbers random as well. Maybe there is a shorter way without adding another line on to make those 5 random too, or not.