views:

219

answers:

1
    $select->where('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?)',$searching_string);
    $select->order('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?) DESC',$searching);

Getting error:

Message: SQLSTATE[HY093]: Invalid parameter number: no parameters were bound

The problem seems in the line with $select->order.

It's for relevance in results. How it should look in Zend Framework?

And there seems some problem with searching. Some words it searches and some not. Why is this working that way? :Z

Thanks

+1  A: 

I think you need to change your select statement so that the MATCH AGAINST portion is moved from the order clause and into the field list.

eg

instead of

SELECT *
FROM mytable
WHERE match(text,phone,phone2) AGAINST ('something')
ORDER BY match(text,phone,phone2) AGAINST ('something');

you would have

SELECT mytable.*, match(text,phone,phone2) AGAINST ('something') AS relevanceScore
FROM mytable
WHERE match(text,phone,phone2) AGAINST ('something')
ORDER BY relevanceScore DESC;

So, more in relation to your case your select would look something more like

$select->from('tableName',array('*','relevenceScore'=>$db->quoteInto('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?)',$searching_string));
$select->where('MATCH(text,phone,phone2,email,email2,www,gadi,augums,skype) AGAINST(?)',$searching_string);
$select->order('relevanceScore DESC');
Mailslut
Thanks! Works like a charm!You saved me!Added + to you :)
Beck