Filter form keyword search is throwing an error
-
Hi, I added a filter form using your PHP example a while back. I’m unskilled in PHP, but I managed to get it working and everything was good. I noticed recently however that a keyword search now returns an error. Selecting a dropdown and searching with an empty search box still works correctly. I think the search box might have stopped working when I updated recently to the latest version of PHP. This is the error I’m getting..
Database Error; SQL: SELECT DISTINCT
t
.* FROMwp_posts
ASt
LEFT JOINwp_postmeta
ASdiscipline
ONdiscipline
.meta_key
= ‘discipline’ ANDdiscipline
.post_id
=t
.ID
WHERE ( ( t.post_title LIKE “%%” ORdiscipline
.meta_value
LIKE “%%” ) AND (t
.post_type
= “athletes” ) AND (t
.post_status
IN ( “publish” ) ) ) AND (post_title
.t
LIKE ‘%andrea lee%’ ) ORDER BYt
.menu_order
ASC,t
.menu_order
,t
.post_title
,t
.post_date
LIMIT 0, 20; Response: Unknown column ‘post_title.t’ in ‘where clause’Here is the PHP..
<?php $pod = pods( 'athletes' ); $keyword = like_escape( pods_v_sanitized( 'keyword', 'post' ) ); $params = array( 'limit' => 20, 'orderby' => 'menu_order ASC', 'where' => 't.post_title LIKE "%' . $keyword . '%" OR discipline.meta_value LIKE "%' . $keyword . '%"' ); //add search filters echo $pod->filters( array( 'fields' => array( 'discipline', 'nationality', 'weight_class', 'weight_range', 'level', 'grouping' ), 'label' => ' ' ) ); //search in athletes pod $pod->find( $params ); // Output the list of the items found echo '<ul>'; // Loop through items found while ( $pod->fetch() ) { echo '<div>...</div>'; } echo '</ul>'; ?>
I added some stuff to try and fix it, but I keep getting a similar error. Any ideas what I’m missing?
The page I need help with: [log in to see the link]
- The topic ‘Filter form keyword search is throwing an error’ is closed to new replies.