Jump to content

fulltext searching and union


olliemaitland

Recommended Posts

I wrote a query which uses the union statement to search two tables...


$q = mysql_query("SELECT sku. * FROM sku, pgr WHERE  MATCH ( pgr.title, pgr.description, pgr.keyword ) AGAINST (  \'".$_POST[\'q\']."\' ) AND sku.pgr=pgr.pgr UNION SELECT sku. *  FROM sku, sgr WHERE  MATCH ( sgr.title, sgr.description, sgr.keyword ) AGAINST (  \'".$_POST[\'q\']."\') AND sku.sgr=sgr.sgr ");

 

then modified it to work on mysql < 4.0.0 to

 


mysql_query("CREATE TABLE temp_union TYPE=HEAP (SELECT sku. * FROM sku, pgr WHERE  MATCH ( pgr.title, pgr.description, pgr.keyword ) AGAINST (  \'".$_POST[\'q\']."\' ) AND sku.pgr=pgr.pgr)");



mysql_query("INSERT INTO temp_union (SELECT sku. *  FROM sku, sgr WHERE  MATCH ( sgr.title, sgr.description, sgr.keyword ) AGAINST (  \'".$_POST[\'q\']."\') AND sku.sgr=sgr.sgr)");



$q = mysql_query("SELECT * FROM temp_union");



mysql_query("DROP TABLE temp_union");

 

however this doesn\'t work on servers which are 3.23.55 when the full text searching was added on 3.23.23

 

can anyone see the problem?

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.