Podcast #128: We chat with Kent C Dodds about why he loves React and discuss what life was like in the dark days before Git. Listen now.
3 of 3 added 10 characters in body

$wpdb->prepare with LIKE and sprintf

Ok, I know similar questions have been asked before but none of the answers I found seem to work. Here's my code:

$sql = $wpdb->prepare('SELECT ID FROM ' . $ignore_url_table_name . " where url LIKE '%%%s%%'", $urlRequested);
$wpdb->get_row($sql);
if ($wpdb->num_rows > 0) {
    return;
}

Here's the problem: I'm trying to detect when a specific string is found in the URL. One example of the url in the talble to look for is:

doing_wp_cron

An example of the $urlRequested is:

doing_wp_cron=1543678213.5953478813171386718750

The above SQL statement doesn't find a match.

I've also attempted to use

$sql = $wpdb->prepare('SELECT ID FROM ' . $ignore_url_table_name . " where url LIKE '%s'", '%' . $wpdb->esc_like($urlRequested) . '%');

This appears to turn the doing_wp_cron into doing//_wp//_cron which the query also doesn't find.

What am I doing wrong here?

Thanks

*Edit: So I echoed out the sql query and this looked strange.

SELECT ID FROM URL_Ignores where url LIKE '{1b71fb783b53a0ae087bf6ac6b01addd9b80435193728fe4c7c7d70b30748268}/doing_wp_cron=1543682280.1607289314270019531250{1b71fb783b53a0ae087bf6ac6b01addd9b80435193728fe4c7c7d70b30748268}'

I have no idea why but it seems every way I try to $wpdb->prepare this it's converting the % into a random variable!???