Problem with db query LIKE

[ad_1]

I followed the example in but this code:


// Remove all page ids from album/photo info for post $ID
function wppa_remove_usedby( $ID ) {
global $wpdb;

	if ( ! wppa_is_posint( $ID ) ) {
		wppa_log( 'err', 'Illegal id in wppa_remove_usedby()' );
		return;
	}
	
	$wild = '%';
	$find = '.' . strval( $ID ) . '.';
	$like = $wpdb->esc_like( $find );
	
	// The albums
	$query = $wpdb->prepare( "SELECT * FROM WPPA_ALBUMS where usedby LIKE %s", $wild . $like . $wild );
	$albums = $wpdb->get_results( $query, ARRAY_A );

...

always returns an empty array, even when $ID is 5

The results of SELECT usedby FROM wp_wppa_albums where usedby <> '' in PHPMyMyAdmin is:



.5.
.3742.
.694.
.694.
.5.694.
.5.
.5.
.5.
.5.
.3742.

So i expect 6 items.

What am i doing wrong???

FYI:


/* Choose the right db prifix */
if ( is_multisite() && WPPA_MULTISITE_GLOBAL ) {
	$wppa_prefix = $wpdb->base_prefix;
}
else {
	$wppa_prefix = $wpdb->prefix;
}

/* DB Tables */
define( 'WPPA_ALBUMS',   $wppa_prefix . 'wppa_albums' );
$wpdb->wppa_albums = WPPA_ALBUMS;
...

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer