Hello everyone!
Just a question : I try to get times form database. The request is based on a calc which search the values of times on a db, . The ajax calculation is based on a multiple dropdown select in a databasejoin element called '{conventions___targeted_competence_raw}'.
Here's my code :
The form shows an error : "Notice: Array to string conversion in..."
When I write :
The calc element shows the values (2,6...) as comma separated values.
I want also add the values of 'exam_duration' (in database the values are in HH:mm:ss. I get it with this code for one value :
How can I manage to do it on multiple values?
Thank you very much
Just a question : I try to get times form database. The request is based on a calc which search the values of times on a db, . The ajax calculation is based on a multiple dropdown select in a databasejoin element called '{conventions___targeted_competence_raw}'.
Here's my code :
PHP:
$competenceTarget = '{conventions___targeted_competence_raw}';
if ($competenceTarget > 0){
$myDb = FabrikWorker::getDbo( false, 3 );
$myQuery = $myDb->getQuery( true );
$myQuery->select( 'exam_duration' )->from( 'data_reac_activity_types' )->where( 'id IN (' . $myDb->quote( $competenceTarget ) . ')' );
$myDb->setQuery( $myQuery );
$results = $myDb->loadAssocList();
//$results = implode(',', $results);
//var_dump($results);
return $results;
} else {
return '0';
}
When I write :
PHP:
return $competenceTarget;
I want also add the values of 'exam_duration' (in database the values are in HH:mm:ss. I get it with this code for one value :
PHP:
$actionTitle = (int) '{conventions___action_title_raw}';
$myDb = FabrikWorker::getDbo( false, 3 );
$myQuery = $myDb->getQuery( true );
$myQuery->select( 'exam_duration' )->from( 'data_reac_professional_titles' )->where( 'id = ' . $myDb->quote( $actionTitle ) );
$myDb->setQuery( $myQuery );
$result = $myDb->loadResult();
$parsed = date_parse( $result );
$resultsSeconds = $parsed[ 'hour' ] * 3600 + $parsed[ 'minute' ] * 60 + $parsed[ 'second' ];
$resultHours = ceil( $resultsSeconds / 60 / 60 );
return $resultHours;
Thank you very much
Last edited by a moderator: