Created
December 15, 2011 14:43
-
-
Save bigandy/1481326 to your computer and use it in GitHub Desktop.
Not working, giving an error. How to insert variable into object???
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function year_sum($year) { | |
return $minutes_cycled_year = $wpdb->get_var($wpdb->prepare(" | |
SELECT SUM($wpdb->postmeta.meta_value) | |
FROM $wpdb->postmeta, $wpdb->posts | |
WHERE $wpdb->postmeta.meta_key='exercise-minutes' | |
AND $wpdb->postmeta.post_id=$wpdb->posts.id | |
AND year($wpdb->posts.post_date)='$year' | |
")); | |
} | |
echo year_sum(2011); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment