Jump to content

Recommended Posts

Hey all,

 

I've indexed the columns in my database that go with the query below, but I am not getting any results when I putting in terms that should be returning results.  Is the syntax in the query incorrect?

 

Thanks so much for any help.

 

J

 

- -

<?php
include 'config.php';
include 'opendb.php';

$keyword = $_POST['keyword'];

$query = "SELECT * FROM Composer_Info WHERE MATCH(compFirst, compLast, compNumber, compEmail, pubCoAff, whereEmployed) AGAINST('$keyword')";
$result = mysql_query($query) or die(mysql_error());
$totalComposers = mysql_num_rows($result);
$counter = 1;


echo "<center>
<table width='55%' cellpadding=0 cellspacing=6 border=0 class=style5>
<tr><td>Total composers: ".$totalComposers."</td></tr></table>
<table width='55%' cellpadding=3 cellspacing=2 border=1 class=style5>
<tr>
<td class=style4>Composer</td>
<td class=style4>Composer Number</td>
</tr>";

while($row = mysql_fetch_array($result, MYSQL_ASSOC))
{	
	$_SESSION['compLast'] = $row['compLast'];
	$_SESSION['compFirst'] = $row['compFirst'];
	$_SESSION['composerid'] = $row['composerid'];
	if ($counter % 2)
	{
		echo "<tr bgcolor='#AFBD22'><td>";	
	}
	else
	{
		echo "<tr bgcolor='#B1BE52'><td>";	
	}
	echo "<a href='composer_info.php?title=".$_SESSION['composerid']."' class='style6' target='_new'>".$_SESSION['compFirst']." ".$_SESSION['compLast']."</a></td><td>";
	echo $row['compNumber'];
	echo "</td></tr>";		
	$counter++;
}

echo "</table></center>";

include 'closedb.php';

?>

If that table doesn't have a lot of rows (i.e. 50% match), FULLTEXT doesn't work well.

 

if you are searching for a word which is very common (occurs in 50% or more than 50% of rows,mysql will return nothing.

specify which kind of search you want a boolean mode search or natural.

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.