mysql - PDO wrong bindings with Laravel -
I have a search query that works fine (I've stripped some unimportant code):
< Pre> $ post = new post; If you are looking for posts with the title (input :: is ('query')) or // $ posts = $ posts matching the given criteria - & gt; Add (DB :: Raw ("Matte (posts.title) AGAINST (()) -> where (function ($ query) {return $ query - & gt;); - & gt; addSelect (DB :: Raw (as "MATCH (tags.title) AGAINST (?) Tag_score") where 'R' (Against posts.title)? - & gt; or Warred ('matte' (tag. (?) ');} -> Order By (DB :: Raw (' Post_score + tag_score ',' Desc ') -> Set bonding ([$ input [' query '] , $ Input ['query'], $ input ['query'], $ input ['query']]);} But as soon as I am above the if () Add this piece of code before the statement:
if (in the input :: ('filter')) {$ posts = $ posts-> where type ( $ Input ['filter']); // filter 'either' question 'or' question '} ... I get this error:
[2014-11-04 19: 28: 18] Production: Error: PDO Error: SQLSTATE [HY093]: Invalid Parameter Number (SQL: Select 'Post'. *, Coalus (SM (Post_VottingEriting), 0) As a rating, match (posttrack) is included in 'post_tag' on `post_tag` Despite the fact that (CSS) is posted as a post_core, it is left as a tag_score against `post` against match (CSS) (CSS) as a post_score. 'Post_id` = `Post` .``` `` `` `` `` `` `` `` `` `` `` `` Post_id_`` `` `` `` `` `Post_id`` `` `` `` `` `` `` Post_id`` `` `` `` ` According to the order of ````` `` `` `` `` `` `` and `CDS (Matt (Postlettl)` CASO ', according to the order of' CDS '(against CSS) or match (tagtitle) P> As entered,cssis entered, the type should be filtered atquestionsas you can see that the variables are not binding correctly (for this Do not know the right word). How is this possible? I have also tried that which does not work:-> Where (use the function ($ query) ($ input) {return $ query - & gt; whereRaw ('MATCH (posts.title), [$ input [' query ']]);} > > Thank you in advance.
This is what you need If the ($ input ['filter']) // filter is either 'article' (input :: is ('filter')) {$ posts- & gt; Or 'question'} if (input :: is ('query')) // it is not required: // $ posts = $ posts // just: $ posts - & gt; AddSelect (db :: raw "Matt (posttrack)" (?) As post_core (?)) - & gt; Adbing ($ input ['query'], 'select') - & gt; Add Selection (db :: raw) - (gt; Gt; etbing ($ input ['query'], 'select') - & gt; where (use the function ($ query) ($ input) {$ query - & gt; jayre ('MATCH (posts.title ), [$ Input ['query']]}}} - & quot; AGAINST (?) ', [$ INPUT [' query ']]) -> ORWhereRaw (against' MATCH (tags.title) Gt; orderbike (db :: raw ('post_store + tag_score'), 'character')}
Comments
Post a Comment