function replaceParams($fields, $params) { $params = str_replace("?", "", $params); $i = 0; $max = count($fields); $keys = array_keys($fields); while ($i < $max) { $params = str_replace("###" . $keys[$i] . "###", $fields[$keys[$i]], $params); $i++; } $i = 0; $ele = explode("&", $params); $max = count($ele); while ($i < $max) { $tmp = explodE("=", $ele[$i]); $salida[$tmp[0]] = $tmp[1]; $i++; } return $salida; }
function answer_result_value($su_id, $answer, $value) { global $g5; $suq_query = "select * from {$g5['surveys_q_table']} where su_id = '{$su_id}' and suq_id = '{$answer}' "; $fetch = sql_fetch($suq_query); $question_answer = array(); for ($i = 1; $i <= 10; $i++) { $question_answer[$i] = $fetch['suq_answer_' . $i]; } $answer_etc_result = $_POST['answer_etc_' . $answer]; $ex_value = explodE(',', $value); $tmp_returns = array(); foreach ($ex_value as $user_answer) { if ($user_answer == 'etc') { $tmp_returns[] = $answer_etc_result; } else { $tmp_returns[] = $question_answer[$user_answer]; } } return implode(',', $tmp_returns); }