Jump to content
New Reality: Ads For Members ×

Combining Random order with REGEXP Search


innovatio

Recommended Posts

I wish to execute a REGEXP search but by a random mechanism. I've used ORDER BY RAND() before but it is getting too performance costly to where I am to evolve to other methods. Here is the REGEXP function in question:

 

 

$searchCD = "SELECT * FROM `table` WHERE `foo` ||', '||

         `bar`  REGEXP '".$keywords."' ";

        $searchST = $con->query($searchCD);

 

 

The alternative order random I wish to splice it with:

 

The

 

SELECT quote FROM quotes LIMIT $generated_number, X

 


 

I've tried numerous times to splice the two methods myself, but nothing works. I would consider other methods, but I don't know how to approach the issue of my database containing missing records from deleted accounts. Thanks!

Can you post your schema and what you're trying to search for with $keywords?

 

Kind of sounds like a not very efficient schema layout.

 

So my schema goes along something like this:

Table: foobar

foo: words specific to foo
bar: words specific to bar

The query basically selects the querys with common "keywords" found in $keywords. The schema layout isn't bad at all. What I am trying to do is to display the matched records in random order.

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.