help me with my Full Text Search code

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

help me with my Full Text Search code

Post by dakkonz »

Can anyone tell me is this the correct way to use the full text search??
but there seems to be something wrong..i keep getting the message
"Not Found".

Code: Select all

if (isset($_POSTї'searching'])) { // Handle the form.
 

			// Add the user.
			$query = "SELECT * FROM client WHERE MATCH (name) AGAINST ('$word');";
            $result = mysql_query ($query);
            $row = mysql_fetch_array($result);

			if ($row) { // If it ran OK.
				echo "Found {$rowї'name']}";
				}			
				
		 else { // If it did not run OK.
				
				echo '<p><font color="red" size="+1">Not Found</font></p>'; 
			&#125;
	   

&#125; // End of the main Submit conditional.
print "<form action='$PHP_SELF?eid=&#123;$row&#1111;'cacc']&#125;' method='post'>";
echo "<b>Enter client's name:</b><input type="text" name="word" size="80"><br><br>";
print "<input type="submit" name="searching" value="Search">";
print "</form>";
mysql_close(); // Close the database connection.
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Code: Select all

$query = ... ('$word');";
Using double ; there. Remove the first on and try again.
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

Post by dakkonz »

okie thanks...gee wat a mistake....
anyway juz wanna check full text search will find only that specific word... it will not find anything close to it rite??
User avatar
JAM
DevNet Resident
Posts: 2101
Joined: Fri Aug 08, 2003 6:53 pm
Location: Sweden
Contact:

Post by JAM »

Specific word. Found this:
http://www.mysql.com/doc/en/Fulltext_Search.html wrote: And here are some examples:

apple banana
find rows that contain at least one of these words.
+apple +juice
... both words.
+apple macintosh
... word ``apple'', but rank it higher if it also contain ``macintosh''.
+apple -macintosh
... word ``apple'' but not ``macintosh''.
+apple +(>turnover <strudel)
... ``apple'' and ``turnover'', or ``apple'' and ``strudel'' (in any order), but rank ``apple pie'' higher than ``apple strudel''.
apple*
... ``apple'', ``apples'', ``applesauce'', and ``applet''.
"some words"
... ``some words of wisdom'', but not ``some noise words''.
dakkonz
Forum Commoner
Posts: 69
Joined: Sat Dec 27, 2003 2:55 am
Location: Asia

Post by dakkonz »

thanks for the help
Post Reply