I use this php to retrieve data from my mysql database:
$wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='C'"); ?>
You may notice that I'm in Wordpress, so I use the $ wpdb variable.
This returns all the data from the table, where status='C' . This all works fine, but I only need to receive data for the last 30 days. I'm not sure mysql stores data about when this record was saved, but I have another column called created on the same line as status . This saves the date in the following format:
2011-10-14 15:33:58
Is there a way to use this to update my code to only recover data from the last month?
All the tips here are greatly appreciated.
Thanks C
date php mysql
Cybercampbell
source share