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 Answer 1

4

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');
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks! Works like a charm! You saved me! Added + to you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.