Hi I have a simple php search that gets one word and searches the text filed of a table and retrieves the data. Now I wish to use more than one word to search the filed, using fulltext (which i have already converted indexed). When I change the command line, I get all sorts of array message errors, can you please point me to the right direction as I have googled out!! here is the current php code that works: ( I am a newbie so please excuse the poor coding) foreach($arr as $kk=>$vv) { $result2 = mysql_query(" SELECT * FROM $vv WHERE Descr LIKE '%$value%' "); if ($row2 = mysql_fetch_array( $result2 )) { if ($table ==1) { echo "<table border='1' align='center'> "; echo "<tr> <th>Part Number</th> <th>Description</th><th >Price (£)</th><th>Pdf</th> </tr>"; $table=$table+1; } while($row2 = mysql_fetch_array( $result2 )) { $pdf = mysql_query( " SELECT * FROM pn_pdf WHERE part_number ='" . $row2['part_number'] . "'") or die(mysql_error()); $rowpdf = mysql_fetch_array($pdf); echo "<tr ><td align=\"center\">"; echo $row2['part_number']; echo "</td><td align=\"center\">"; echo $row2['Descr']; echo "</td><td align=\"center\">"; echo $row2['Price ()']; echo "</td><td align=\"center\">"; echo "<a target=\"_blank\" href=\"http://www.xxx.com/pdf/item1/ $rowpdf[pdf].pdf\"><img class=\"pdf\" src=\"../images/others/pdflogo.gif\"></a>"; } /// while loop } /// if ($row2 = mysql_fetch_array( $result2 )) loop if ($table ==1) echo "No such part description, please try again"; } /// foreach($arr as $kk=>$vv) loop Code (markup): I thought changing the result2 line to : $result2 = mysql_query(" SELECT * FROM $vv WHERE Match(Descr) AGAINST($'value') "); Code (markup): But as I said this does not work. Any help will be much much appreciated. thanks
Hey, I'm not really sure but you could modify it like this: $result2 = mysql_query(" SELECT * FROM $vv WHERE Descr LIKE '%$value%' [B]OR Descr LIKE '%$value2%'[/B] "); Code (markup): I don't see how you're using the values so I can't really get into it.
Hi thanks for your reply. I am trying to avoid using the LIKE statement and use FULL-TEXT search instead, if I can. "$value" is what the visitor types to search a database. A text or words really. What I ideally want to do is to modify the code so I can search the database using one or more words that the visitor types. A bit like google really. So if a customer types "imperial plates", I want the code to look into the description field and fetch all the rows that have "description" AND "plates" in them and list them. At the moment I can search successfully using a single word, similar to what you suggested and would like it to use more than one word. I have heard that FULL-TEXT is very quick and is ideally suited for this kind of job. Hope there is more info for you. p.s. Are there any php functions that I can use? I have searched every where.
Hi Fairuz Thats exactly what I want, but unfortunately the demo doesn't work and can't see the download page at all (I am using mac osx) which is not very encouraging. Just my luck. Cheers