atamashi
New Member
Hi, Mustafa_s, help me please.
I collected survey data received radio buttons.en a form.
The data is in a table and in each column can evaluate a value that is 1, 2, 3, 4 or 5. To graph for each column need to count how many times each value appears. Counts they write in another table whose columns are excellent, very good, good, fair and poor. In the survey form in your PHP form Plugin I have written this script (I have corrected the code) but does not work yet and do not understand what is wrong or that I lack. Thanks for your help
// Cheque para asegurar que este archivo se incluye en Joomla!
defined('_JEXEC') or die();
$callcenters = (array) $formModel->formData['calif_canos_por_favor___su_servicio_recibido_del_call_center_ha_sido'];
$callcenters = is_array($callcenters) ? $callcenters[0] : $callcenters;
if (is_array($callcenters)){
foreach ($callcenters as $call){
if ($call == 5) {
$callexc = $callexc + 1;
} elseif ($call == 4) {
$callmuyb = $callmuyb + 1;
} elseif ($call == 3) {
$callbue = $callbue + 1;
} elseif ($call == 2) {
$callreg = $callreg + 1;
} elseif ($call == 1) {
$callmalo = $callmalo + 1;
}
}
}
// Get the db and the query
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Clear down any previous query
$query->clear();
// Update the query to decrease the value contained
// in the field "spaces" by 1 for the current course id.
$query->update('carta_calidad')->set('excelente = $callexc','muy_bueno = $callmuyb','bueno = $callbue','regular = $callreg','malo = $callmalo')->where('nombre = Call-Center');
$db->setQuery($query);
$db->execute();
I collected survey data received radio buttons.en a form.
The data is in a table and in each column can evaluate a value that is 1, 2, 3, 4 or 5. To graph for each column need to count how many times each value appears. Counts they write in another table whose columns are excellent, very good, good, fair and poor. In the survey form in your PHP form Plugin I have written this script (I have corrected the code) but does not work yet and do not understand what is wrong or that I lack. Thanks for your help
// Cheque para asegurar que este archivo se incluye en Joomla!
defined('_JEXEC') or die();
$callcenters = (array) $formModel->formData['calif_canos_por_favor___su_servicio_recibido_del_call_center_ha_sido'];
$callcenters = is_array($callcenters) ? $callcenters[0] : $callcenters;
if (is_array($callcenters)){
foreach ($callcenters as $call){
if ($call == 5) {
$callexc = $callexc + 1;
} elseif ($call == 4) {
$callmuyb = $callmuyb + 1;
} elseif ($call == 3) {
$callbue = $callbue + 1;
} elseif ($call == 2) {
$callreg = $callreg + 1;
} elseif ($call == 1) {
$callmalo = $callmalo + 1;
}
}
}
// Get the db and the query
$db = JFactory::getDbo();
$query = $db->getQuery(true);
// Clear down any previous query
$query->clear();
// Update the query to decrease the value contained
// in the field "spaces" by 1 for the current course id.
$query->update('carta_calidad')->set('excelente = $callexc','muy_bueno = $callmuyb','bueno = $callbue','regular = $callreg','malo = $callmalo')->where('nombre = Call-Center');
$db->setQuery($query);
$db->execute();