Title: Using cache variable in Where &quot;AND
Last modified: August 30, 2016

---

# Using cache variable in Where "AND

 *  [ragordon](https://wordpress.org/support/users/ragordon/)
 * (@ragordon)
 * [10 years, 10 months ago](https://wordpress.org/support/topic/using-cache-variable-in-where-and/)
 * I am using the Abase shortcode in the sidebar.
    I need to use a variable ($listing_id)
   as a search variable. in the code below hoaid= “$listing_id” –
 * [abase table= “wp_awpcp_ads” columns = “ad_title, hoaid” notitle=”1″ where= “
   AND hoaid = ‘$lisitng_id’ ” echo=”0″]
    (this does not work)
 * Also in the sidebar I am retrieving the listing id (from a current directory 
   listing) with the following php, which works fine- I have not been able to figure
   out a way to get Abase to recognize the variable and use it for the search.
 * <?php
    $id_or_slug = ”; if ( get_query_var( ‘listing’ ) || isset( $_GET[‘listing’]))
   $id_or_slug = get_query_var( ‘listing’ ) ? get_query_var( ‘listing’ ) : wpbdp_getv(
   $_GET, ‘listing’, 0 ); else $id_or_slug = get_query_var( ‘id’ ) ? get_query_var(‘
   id’ ) : wpbdp_getv( $_GET, ‘id’, 0 );
 * $listing_id = wpbdp_get_post_by_id_or_slug( $id_or_slug, ‘id’, ‘id’ );
    $field
   = wpbdp_get_form_field( 13); echo $field->display( $listing_id ); ?> <p> <?php
   echo $listing_id; ?> </p> <?php echo post_permalink( $listing_id ); ?>
 *  Any help would be appreciated
 * Thanks
    ragordon
 * [https://wordpress.org/plugins/abase/](https://wordpress.org/plugins/abase/)

The topic ‘Using cache variable in Where "AND’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/abase.svg)
 * [ABASE](https://wordpress.org/plugins/abase/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/abase/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/abase/)
 * [Active Topics](https://wordpress.org/support/plugin/abase/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/abase/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/abase/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [ragordon](https://wordpress.org/support/users/ragordon/)
 * Last activity: [10 years, 10 months ago](https://wordpress.org/support/topic/using-cache-variable-in-where-and/)
 * Status: not resolved