# Match Against not working

**URL:** https://forum.kirupa.com/t/match-against-not-working/265080
**Category:** programming
**Created:** [July 3, 2008, 5:58pm UTC](https://forum.kirupa.com/t/match-against-not-working/265080 "2008-07-03T17:58:47Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Icy\_Penguin](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@Icy\_Penguin](https://forum.kirupa.com/u/Icy_Penguin)
#### Post date: [July 3, 2008, 5:58pm UTC](https://forum.kirupa.com/t/match-against-not-working/265080/1 "2008-07-03T17:58:47Z")

</div>

```auto
$books_sql .= "SELECT *, MATCH (title) AGAINST ('$keywords') AS score FROM books WHERE MATCH (title) AGAINST ('$keywords') ORDER BY SCORE desc";

```

Right now I just have two rows in my table - one of which whose title is “some boring book”.

When I set $keywords to ‘some’ or ‘boring’, for example, I get no rows returned. Do I need to put in more rows if I want to test out my search function?

---

<div class="post-metadata">

### Author: ![stiffi](https://avatars.discourse-cdn.com/v4/letter/s/e99b99/32.png) [@stiffi](https://forum.kirupa.com/u/stiffi)
#### Post date: [July 3, 2008, 10:20pm UTC](https://forum.kirupa.com/t/match-against-not-working/265080/2 "2008-07-03T22:20:56Z")

</div>

although im in no way an expert but i would try something like this

```php

$var = @$_GET['query'] ; //or whatever you have named it in your search form 
  $trimmed = trim($var);
$query = "select * from table where 1_field like \"%$trimmed%\"  
  order by 1_field"; 

```

---

<div class="post-metadata">

### Author: ![Icy\_Penguin](https://avatars.discourse-cdn.com/v4/letter/i/f6c823/32.png) [@Icy\_Penguin](https://forum.kirupa.com/u/Icy_Penguin)
#### Post date: [July 4, 2008, 12:05am UTC](https://forum.kirupa.com/t/match-against-not-working/265080/3 "2008-07-04T00:05:19Z")

</div>

That’s what I had before - but I realized after doing some research that this is the old and ugly way to do it - and fulltext is the way to go now.

Thanks
