sql - Webform : how to count and live display results -


update (that 1 works)

<?php if (arg(0) == 'node' && is_numeric(arg(1))) {   $nid = arg(1);   $node = node_load($nid);   if ($node->type == 'webform') {     $count = db_result(db_query('select count(*) {webform_submissions} nid = %d', $nid));     $atelier_1 = "sources" ;     $sql = "select count(*) {webform_submitted_data} data \"".$atelier_1."\" ;";     $count_atel_1 = db_result(db_query($sql));   } } echo $sql; echo $count_atel_1; ?>  webform has been submitted <?php print $count ?> times. 

we'd use webform our students should register on workshops.

the webform works great. we'd display live number of students register in on of workshops other should know if there remains possibilities of registration (each workshop can accept 20 students @ same time)

i'm trying that doesn't work ($atelier_1 = "sources" ;) name of 1 workshop :

<?php if (arg(0) == 'node' && is_numeric(arg(1))) {   $nid = arg(1);   $node = node_load($nid);   if ($node->type == 'webform') {     $count = db_result(db_query('select count(*) {webform_submissions} nid = %d', $nid));     $atelier_1 = "sources" ;     $count_atel_1 = db_result(db_query('select count(*) {webform_submitted_data} data %d', $atelier_1');   } }  echo $count_atel_1; ?> 

any or suggestion welcome

the way can show live, creating ajax in drupal, or drupal behaviours, or javascript.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -