WPDB prepare – like % – placeholders?

Yes, they’re normal. They were added in 4.8.3 to fix an SQL injection vulnerability. You can read an article describing the technical reasons for this happening here and the ticket for the change here. The placeholder characters are replaced by the random characters on the last line of $wpdb->prepare() with the $wpdb->add_placeholder_escape() function, which calls … Read more

$wpdb:insert, more arguements in $format array than in $data

I think you’re assuming this is intentional, it’s probably just a bug in the theme, what it’s stating is the 5th parameter is a string, but there is no 5th parameter so it’s ignored. The most likely reason is that during development a 5th entry was removed and the author forgot to update the second … Read more

Get count of rows based if column exists in two different tables

You need to use a join in your mysql query. Something like this might get you closer… global $wpdb; $rsvp_table = $wpdb->prefix . ‘rsvp’; $invites_table = $wpdb->prefix . ‘invites’; $sql=”SELECT COUNT(*) as count FROM $invites_table i1 JOIN $rsvp_table r1 ON (r1.reference = i1.reference)”; $yet_to_respond = $wpdb->get_results( $sql ); echo $yet_to_respond->count;

How does $wpdb->get_var work with offset?

You must specify values for column_offset and row_offset. For example: <?php $wpdb->get_var( null, 5, 0 ); ?> Will return “Hello World” (see attached image) But for that to work you had to have a previous query like this: <?php $wpdb->get_var( “SELECT * FROM $wpdb->posts” ); ?>