Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been at this for while, but can't figure out why the below isn't working. I have my date saved as a 'MM/DD/YYYY' string.

global $wpdb;
$new_day = $day->format("m/d/Y");
$qty = $wpdb->get_var( $wpdb->prepare( 
  "
    SELECT qty
    FROM $wpdb->specials
    WHERE date = %s
  ",
  $new_day
));
share|improve this question
    
Where does $day->format("m/d/Y"); come from as it isn't shown as global. –  kaiser Apr 11 '12 at 9:57

1 Answer 1

I'll guess that $wpdb->specials isn't giving you what you expect. custom tables have to referenced like $wpdb->prefix . 'specials'

share|improve this answer
    
thanks Milo. found that because it a custom table, you dont need the $wpdb at all. –  Aaron Moodie Apr 11 '12 at 4:36
    
@AaronMoodie you don't, however if the table prefix set in wp-config.php may ever change, you'll want to have that in there. –  Milo Apr 11 '12 at 8:33

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.