Gossamer Forum
Home : Products : Gossamer Links : Version 1.x :

2 important questions

Quote Reply
2 important questions
Hi,

how can I sort all the links randomly? Has anyone the correct code for a live search?

I have looked at several postings, but didn't find a solution.

Thanks!
Danny
Quote Reply
Re: 2 important questions In reply to
What do you mean a "live" search?

Right now I don't know a good way to sort the links randomly, meaning, randomly sorted each time they are called.

If you _really_ want to do something randomly, one way would be to set up a field in the links record called "random_order" and before you generate your database, run through the database, and assign that field a random value. That will change the value in every link, prior to each run-through, so when you select the links, and your sort order is "random_order ASC" your links will be ordered in that way.

You might be able to do it with:

UPDATE Table Links set random_order = RAND(UNIX_TIME)

Run at the begining of nph_build in the initialization area.

Doing it before _each_ SELECT statement would impose a _major_ performance hit, but it would change the order of the links in each and every page/category ....



------------------
POSTCARDS.COM -- Everything Postcards on the Internet www.postcards.com
LinkSQL FAQ: www.postcards.com/FAQ/LinkSQL/








Quote Reply
Re: 2 important questions In reply to
Hi,

a "live search" is a feature to show what other people are looking for just right at the moment.

Fireball, the biggest german search engine has one: http://www.fireball.de/...ction=voyeur-queries

For the random feature, I was trying to use your code in the following way:

$LINKDB->do ("UPDATE Links set random_order = RAND(UNIX_TIME)");

But RAND(UNIX_TIME) is not working! Have you go another code to generate a random value?

THANKS!
Danny
Quote Reply
Re: 2 important questions In reply to
Hi Danny,

Have a look at:

http://www.gossamer-threads.com/...um9/HTML/000363.html

for some more details about the "live search".

As for the query try:

UPDATE Links SET random_order = FLOOR(RAND() * 10000);

Cheers,

Alex
Quote Reply
Re: 2 important questions In reply to
Hi Alex,

your code for random order works fine, thanks a lot!

But I got still problems with the "live search". You pointed to a thread, but a real solution was not given there. Perhaps you could help me once again?

Bye,
Danny