Hello Everyone,
After reading books, manuals and searching, I could not find the answer to my problem: I'm trying to do a full text search and echo results based on the MATCH() function. In my code, the MATCH function "seems" to work fine but when I try to fetch results with a while loop I get an error on that line. I've been trying to fix this for 3 days now with no luck and am ready to kick my own ass!
My while loop works fine when simply displaying the table but when I added the MATCH() function to the $Query ='s line, my while loop does not work. I made the City and City2 columns FULLTEXT indexes at create table time, so thats not the problem. Could the problem be that the text in the City and City2 fields are arrays? My script is pasted below, PLEASE HELP!!!!! Thank You!
<HEAD><TITLE>Full text search</TITLE></HEAD>
<BODY>
<?php
// Set the variables for the database access:
$Host = "localhost";
$User = "root";
$Password = "password";
$DBName = "DataSiteDatabase";
$TableName = "Search";
$Link = mysql_connect ($Host, $User, $Password);
$Query= "SELECT FROM $TableName WHERE MATCH (City,City2) AGAINST ('dania')";
$Result = mysql_db_query ($DBName, $Query, $Link);
// Fetch the results from the database.
while ($Row = mysql_fetch_array ($Result)) /error is on this line*/
{print ("$Row[UserName]\n");
}
mysql_close ($Link);
?>
</BODY>