Retrieving a Value from a wp-database
I believe for your foreach function should be like below: foreach ($result as $item){ $eventname= $item->meta_value; }
I believe for your foreach function should be like below: foreach ($result as $item){ $eventname= $item->meta_value; }
Turn on define( ‘WP_DEBUG’, true ); and define( ‘SAVEQUERIES’, true ); . I prefer the format of the debug bar, http://wordpress.org/extend/plugins/debug-bar/ , which can be combined with the console, http://wordpress.org/extend/plugins/debug-bar-console/ . This script is great for profiling, Best Collection of Code for your functions.php file There are some other plugins that might help, like Debug … Read more
First of all i wouldn’t use phpmyadmin for a database that large. Use something like Sequel Pro its free and easy to use. Second if you dont want the tables that WPML Created and you have removed the plugin from your site you can remove the tables that it creates. Upload the sql to a … Read more
You can do this one of two ways, as far as I can see: Use PHP to combine the current results to the one you want. Basically: $records = array(); foreach( $results as $result ) { $record_id = $result[‘item_id’]; if (empty($records[$record_id])) { $records[$record_id][‘item_id’] = $result[‘item_id’]; $records[$record_id][‘item_name’] = $result[‘item_name’]; $records[$record_id][‘sub_items’] = array(); } $records[$record_id][‘sub_items’][] = array( … Read more
It should be simple since comments are stored with a user_id if they are created by a logged in user and if not then its set to false so all you need to do is select the post id from comments that are made by user_id bigger the zero, something like this: function get_posts_with_loogedin_user_comments(){ global … Read more
Think about your query. You are asking that $wpdb->postmeta.meta_key be both “foo” and “bar”. That will never happen. If you ran this in a context where you’d get to read MySQL debugging data (PhpMyAdmin’s SQL console will do this) you would probably see a warning about an “impossible where clause”. You need to JOIN on … Read more
Of course, minutes after posting this I work it out. The following worked: SELECT m.* FROM wp_postmeta m WHERE m.meta_key = ‘image’ AND NOT EXISTS (SELECT * FROM wp_posts p WHERE m.meta_value = p.ID)
If you have already created the database that you wish to import into and you have selected that database in PHPMyAdmin, but the import file is trying to create a new database, then you will see this error message. All you need to do is open up the SQL file in a text editor and … Read more
You basically have the answer, just add $date2 to the inner sql where clause: AND p.post_date > ‘$date2’ to get last week. To get a particular week, use AND p.post_date < ‘$date1’ AND p.post_date > ‘$date2’ where eg $date1 = date(‘Y-m-d’, strtotime(‘2014-07-04 +1 days’)); $date2 = date(‘Y-m-d’, strtotime(‘2014-07-04 -8 days’)); To return weekly/total votes, you … Read more
These look like 2 separate questions. The first I think is a single vs double quotes issue: Try this: $html=””; foreach ( $recent_across_network as $post ) { $html .= ‘blog_id, ‘.$post->ID.’ ) . ‘”>’ . $post->post_title . ”; } $html .= ”; The line in the foreach is putting $post->ID in single quotes which won’t … Read more