New answers tagged

0

I always find it way less confusing to get the results from one table and loop them rather than to try to join them like that... eg. global $wpdb; $query = "SELECT post_id FROM wp_postmeta WHERE meta_key='fake_author' AND meta_value='11111'"; $results = $wpdb->get_results($query); foreach ($results as $result) { $query = "UPDATE wp_posts SET ...


0

Woah there. You've just opened up a can of SQL injection. I use the default get_query_var('s') that I believe is automatically escaped by wordpress. Not quite - get_search_query() will do that, but get_query_var( 's' ) gets the "raw" value. Regardless, always use wpdb::prepare or similar escaping before executing SQL: $query = $wpdb->prepare( "...


0

This is actually a MySQL question and not related to WordPress but you can replace now() with NOW() + INTERVAL 1 DAY



Top 50 recent answers are included