[wp-hackers] WP 3.5.2/multisite: How to use NOT IN in $wpdb->prepare()?
info at bungeshea.com
Tue Jul 16 07:04:03 UTC 2013
You should have a look at the absint (http://queryposts.com/function/absint) function - it will make sure that a variable is a positive integer.
If you're dealing with an array of blog IDs, use array_map( $blog_ids, 'absint' ); (http://www.php.net/array_map) to apply the absint function to all of the array elements.
> From: mickyhulse.lists at gmail.com
> Date: Mon, 15 Jul 2013 23:55:07 -0700
> To: wp-hackers at lists.automattic.com
> Subject: Re: [wp-hackers] WP 3.5.2/multisite: How to use NOT IN in $wpdb->prepare()?
> On Mon, Jul 15, 2013 at 11:28 PM, Shea Bunge <info at bungeshea.com> wrote:
> > What format are the blog ids stored in, and where did they come from?
> Great question. Sorry that I did not mention that before.
> I have a couple of functions that allow me to get latest updated blogs
> on our multisite. The IDs are controlled by me, the developer, and
> I've allowed them to be overridden via function arguments. There will
> be no forms or users (ones that I don't trust) that will have access
> to this code, so I can be pretty certain the input will be legit.
> Maybe I'm being overly cautious? I guess a part of me wants to just
> play it safe even though I completely trust where the IDs are coming
> from. :)
> Thanks for asking! Let me know if you have feedback.
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
More information about the wp-hackers