1
I have a problem building a query here:
$sql = $wpdb->prepare("SELECT * FROM {$wpdb->prefix}imagens WHERE categorias LIKE %d limit %s, %s", array('%' . $wpdb->esc_like($var['busca']) . '%', $init, 45));
$registers = $wpdb->get_results($sql);
Returns nothing.
Before it was like this and I listed it perfectly:
$sql = "SELECT * FROM wp_imagens WHERE categorias LIKE '%".$var['busca']."%' $init,45";
$registers = $wpdb->get_results($sql);
What’s wrong with the prepare query?
With prepare do not need a execute no? Type:
$wpdb->execute();
– Miyukii