Forums

This topic is locked

random record in recordset

Posted 03 Oct 2002 16:21:21
1
has voted
03 Oct 2002 16:21:21 Berry van Elk posted:
I have a recordset with something like 50 records, in my page i have a repeat region with 10 records. I want to know how ik can make my recordset randomly so that the repeat region always gives a different layout with other records.

Is this simple ? Or do i have a little problem ?

Replies

Replied 03 Oct 2002 17:09:37
03 Oct 2002 17:09:37 Brent Colflesh replied:
Dear StReZzKIP,
It's not technically possible to do real "random" generation, but you can get close enough for your purposes:

www.mysql.com/doc/en/Mathematical_functions.html#IDX1261

ORDER BY RAND() LIMIT 10

Regards,
Brent

Replied 03 Oct 2002 17:39:22
03 Oct 2002 17:39:22 Berry van Elk replied:
It doens't work and i don't know why

my original code looked like this :

SELECT *
FROM Aanbod
ORDER BY LINK_ID DESC


I changed it too :

SELECT *
FROM Aanbod
ORDER BY RAND() LIMIT 10


I get the following error :

Syntax error, missing operator in query expression RAND() LIMIT 10


I'm using a msAcces db, could that be the problem ?

Replied 04 Oct 2002 18:29:26
04 Oct 2002 18:29:26 Brent Colflesh replied:
Dear StReZzKIP,
Doh, I just always assume people are using the best database available <img src=../images/dmxzone/forum/icon_smile.gif border=0 align=middle> - The following link is for ASP & Access:

www.codefixer.com/tutorials/random_record.asp

Regards,
Brent

Replied 04 Oct 2002 19:45:42
04 Oct 2002 19:45:42 Berry van Elk replied:
Yeah i know, i still need to learn working with a msql database.

But thank you for the url, exactly where i was looking for

Reply to this topic