Here is an example of the sort of script i used for searching
<?php
include ("www.php");
mysql_connect($ServerName,$Username,$Password) or die("Could not connect to the database");
mysql_select_db($DatabaseName) or die("Could not select database");
$qr = mysql_query("SELECT * FROM ".$DatabaseName."_pictures WHERE keywords LIKE '%$search1%' ORDER BY '$myOrder'");
$nrows = mysql_num_rows($qr);
$rString = "&n=".$nrows;
for ($i=0; $i < $nrows; $i++) {
$row = mysql_fetch_array($qr);
$rString .= "&title".$i."=".$row['title'];
$rString .= "&pid".$i."=".$row['pid'];
}
echo $rString."&endofdata=".$i;
?>
this works fine using the LIKE statement.
However if I use:
<?php
include ("www.php");
mysql_connect($ServerName,$Username,$Password) or die("Could not connect to the database");
mysql_select_db($DatabaseName) or die("Could not select database");
$qr = mysql_query("SELECT keywords FROM ".$DatabaseName."_pictures MATCH(keywords) AGAINST('lanka')");
$nrows = mysql_num_rows($qr) or die("Error: ".mysql_error()) ;
$rString = "&n=".$nrows;
for ($i=0; $i < $nrows; $i++) {
$row = mysql_fetch_array($qr);
$rString .= "&title".$i."=".$row['title'];
$rString .= "&pid".$i."=".$row['pid'];
}
echo $rString."&endofdata=".$i;
?>
I get an error stating that the loop where $nrows occurs is wrong. I know it is not wrong because it works fine when i use the LIKE command. (Just so you know i need the php to resolve to variable pairs so that i can integrate it with a flash front end)
I can only assume that the response you get from the like command differs from the MATCH AGAINST command. If you ignore the loop part you get no error so i do not think i have messed up the MATCHAGAINST command but i cud of 🙁
As I said i think the results you get from MATCH AGAINST are different to LIKE. I have used LIKE loads and it works fine....this is the first time I have tried to use the MATCH AGAINST and I don't think i understand it fully. I have searched forums and the mysql site to no avail.
any help would be greatly appreciated.
marcus