Skip to content

Instantly share code, notes, and snippets.

@juvenn
Created February 16, 2011 12:53
Show Gist options
  • Save juvenn/829319 to your computer and use it in GitHub Desktop.
Save juvenn/829319 to your computer and use it in GitHub Desktop.
getPreload.php
function getPreload($field, $table, $id = "", $database = "", $syid = 1){
global $survey, $config;
if ($id == ""){
$id = $survey->primaryKey;
}
if ($config->getDataKey() != ""){
$answertext = "AES_DECRYPT(answertext, '" . $config->getDataKey() . "') as answertext_dec";
}
else {
$answertext = "answertext";
}
$query = "select $answertext from $table where prim_key = '" . $id . "' and fieldname='$field' and syid=$syid";
// echo $query . ":" . $database . "<hr>";
if (!($result = askQuery($query, $database))){
}
else{
if (mmic_database_num_rows($result) == 0){
}
else{
$record = mmic_database_fetch_array($result);
return $record[0];
}
}
return "";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment