Hello everyone,
i'm not a database hard coder, but i love wordpress so i'd like to know more.
i'm using wordpress + cformsII for a school website.
i have a form for each lesson, so students can subscribe to single lessons, and i have to manage a maximum number of students registrations, different for each lesson.
so in the plug-in backend i've set a maximum number of submission different for each form resulting in a "Registrations are closed" sentence after the number of submission is reached.
but now i'd love to have a counter for the number of seats left, such as "There are 2 more seats left, hurry up!"
i didn't find an automatic way to do this so i'm trying to do a query directly on the database and having a numerical result to show on the page.
i've found that the number of submissions is stored in the new table wp_cformssubmission under form_id
and the maximum number of submission set is stored in the table wp_cformsdata under field_val where field_name is "Set the maximum number of students" and sub_id is the number of the lesson.
so now, math should be simple: (maximum number students) - (registrations) = (number of seats left)
but my poor knowledge of MySQL won't help me in getting the query works...
i tried different ways starting from here http://codex.wordpress.org/Function_Reference/wpdb_Class but i'm stuck.
any help?
thank you in advance.
alessandro