本文整理汇总了PHP中db_execute_assoc函数的典型用法代码示例。如果您正苦于以下问题:PHP db_execute_assoc函数的具体用法?PHP db_execute_assoc怎么用?PHP db_execute_assoc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_execute_assoc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getUserNameFromUid
function getUserNameFromUid($uid)
{
$query = "SELECT users_name, uid FROM " . db_table_name('users') . " WHERE uid = {$uid};";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
if ($result->RecordCount() > 0) {
while ($rows = $result->FetchRow()) {
return $rows['users_name'];
}
}
}
示例2: get_max_question_order
/**
* Gets the maximum question_order field value for a group
*
* @param mixed $gid The id of the group
* @return mixed
*/
function get_max_question_order($gid)
{
global $connect;
global $dbprefix;
$query = "SELECT MAX(question_order) as maxorder FROM {$dbprefix}questions where gid=" . $gid;
// echo $query;
$result = db_execute_assoc($query);
// Checked
$gv = $result->FetchRow();
return $gv['maxorder'];
}
示例3: defdump
function defdump($tablename)
{
global $connect;
$def = "";
$def .= "#\n";
$def .= "# Table definition for {$tablename}" . "\n";
$def .= "#\n";
$def .= "DROP TABLE IF EXISTS {$tablename};" . "\n" . "\n";
$def .= "CREATE TABLE {$tablename} (" . "\n";
$result = db_execute_assoc("SHOW COLUMNS FROM {$tablename}") or die("Table {$tablename} not existing in database");
while ($row = $result->FetchRow()) {
$def .= " `{$row['Field']}` {$row['Type']}";
if (!is_null($row["Default"])) {
$def .= " DEFAULT '{$row['Default']}'";
}
if ($row["Null"] != "YES") {
$def .= " NOT NULL";
}
if ($row["Extra"] != "") {
$def .= " {$row['Extra']}";
}
$def .= ",\n";
}
$def = preg_replace("#,\n\$#", "", $def);
$result = db_execute_assoc("SHOW KEYS FROM {$tablename}");
while ($row = $result->FetchRow()) {
$kname = $row["Key_name"];
if ($kname != "PRIMARY" && $row["Non_unique"] == 0) {
$kname = "UNIQUE|{$kname}";
}
if (!isset($index[$kname])) {
$index[$kname] = array();
}
if ($row["Sub_part"] != '') {
$row["Column_name"] .= " ({$row["Sub_part"]})";
}
$index[$kname][] = $row["Column_name"];
}
while (list($x, $columns) = @each($index)) {
$def .= ",\n";
if ($x == "PRIMARY") {
$def .= " PRIMARY KEY (" . implode($columns, ", ") . ")";
} else {
if (substr($x, 0, 6) == "UNIQUE") {
$def .= " UNIQUE " . substr($x, 7) . " (" . implode($columns, ", ") . ")";
} else {
$def .= " KEY {$x} (" . implode($columns, ", ") . ")";
}
}
}
$def .= "\n);\n\n\n";
return stripslashes($def);
}
示例4: create_subQuestions
function create_subQuestions(&$question, $qid, $varname, $use_answers = false)
{
global $dom;
global $dbprefix;
global $connect;
global $quexmllang;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
if ($use_answers) {
$Query = "SELECT answer as question, code as title FROM {$dbprefix}answers WHERE qid = {$qid} AND language='{$quexmllang}' ORDER BY sortorder ASC";
} else {
$Query = "SELECT * FROM {$dbprefix}questions WHERE parent_qid = {$qid} and scale_id = 0 AND language='{$quexmllang}' ORDER BY question_order ASC";
}
$QueryResult = db_execute_assoc($Query);
while ($Row = $QueryResult->FetchRow()) {
$subQuestion = $dom->create_element("subQuestion");
$text = $dom->create_element("text");
$text->set_content(cleanup($Row['question']));
$subQuestion->append_child($text);
$subQuestion->set_attribute("varName", $varname . cleanup($Row['title']));
$question->append_child($subQuestion);
}
return;
}
示例5: fixorder
/**
* Function rewrites the sortorder for a label set
*
* @param mixed $lid Label set ID
*/
function fixorder($lid) {
global $dbprefix, $connect, $labelsoutput;
$qulabelset = "SELECT * FROM ".db_table_name('labelsets')." WHERE lid=$lid";
$rslabelset = db_execute_assoc($qulabelset) or safe_die($connect->ErrorMsg());
$rwlabelset=$rslabelset->FetchRow();
$lslanguages=explode(" ", trim($rwlabelset['languages']));
foreach ($lslanguages as $lslanguage)
{
$query = "SELECT lid, code, title, sortorder FROM ".db_table_name('labels')." WHERE lid=? and language=? ORDER BY sortorder, code";
$result = db_execute_num($query, array($lid,$lslanguage)) or safe_die("Can't read labels table: $query // (lid=$lid, language=$lslanguage) ".$connect->ErrorMsg());
$position=0;
while ($row=$result->FetchRow())
{
$position=sprintf("%05d", $position);
$query2="UPDATE ".db_table_name('labels')." SET sortorder='$position' WHERE lid=? AND code=? AND title=? AND language='$lslanguage' ";
$result2=$connect->Execute($query2, array ($row[0], $row[1], $row[2])) or safe_die ("Couldn't update sortorder<br />$query2<br />".$connect->ErrorMsg());
$position++;
}
}
}
示例6: surveyCreateTable
/**
* Creates the initial survey table with columns for selected survey settings
* Returns true if successful and database error if not
* @param surveyid
* @return mixed
*/
function surveyCreateTable($surveyid)
{
global $dbprefix, $databasetabletype, $connect;
$createsurvey = '';
//Check for any additional fields for this survey and create necessary fields (token and datestamp)
$pquery = "SELECT anonymized, allowregister, datestamp, ipaddr, refurl FROM {$dbprefix}surveys WHERE sid={$surveyid}";
$presult = db_execute_assoc($pquery);
$prow = $presult->FetchRow();
//Get list of questions for the base language
$fieldmap = createFieldMap($surveyid);
foreach ($fieldmap as $arow) {
$createsurvey .= " `{$arow['fieldname']}`";
switch ($arow['type']) {
case 'id':
$createsurvey .= " I NOTNULL AUTO PRIMARY";
break;
case 'token':
$createsurvey .= " C(36)";
break;
case 'startlanguage':
$createsurvey .= " C(20) NOTNULL";
break;
case "startdate":
case "datestamp":
$createsurvey .= " T NOTNULL";
break;
case "submitdate":
$createsurvey .= " T";
break;
case "lastpage":
$createsurvey .= " I";
break;
case "ipaddress":
if ($prow['ipaddr'] == "Y") {
$createsurvey .= " X";
}
break;
case "url":
if ($prow['refurl'] == "Y") {
$createsurvey .= " X";
}
break;
}
$createsurvey .= ",\n";
}
//strip trailing comma and new line feed (if any)
$createsurvey = rtrim($createsurvey, ",\n");
$tabname = "{$dbprefix}survey_{$surveyid}";
# not using db_table_name as it quotes the table name (as does CreateTableSQL)
$taboptarray = array('mysql' => 'ENGINE=' . $databasetabletype . ' CHARACTER SET utf8 COLLATE utf8_unicode_ci', 'mysqli' => 'ENGINE=' . $databasetabletype . ' CHARACTER SET utf8 COLLATE utf8_unicode_ci');
$dict = NewDataDictionary($connect);
$sqlarray = $dict->CreateTableSQL($tabname, $createsurvey, $taboptarray);
$execresult = $dict->ExecuteSQLArray($sqlarray, 1);
if ($execresult == 0 || $execresult == 1) {
return $connect->ErrorMsg();
} elseif ($execresult != 0 && $execresult != 1) {
// Set Auto Increment value if specified
$anquery = "SELECT autonumber_start FROM {$dbprefix}surveys WHERE sid={$surveyid}";
if ($anresult = db_execute_assoc($anquery)) {
//if there is an autonumber_start field, start auto numbering here
while ($row = $anresult->FetchRow()) {
if ($row['autonumber_start'] > 0) {
$autonumberquery = "ALTER TABLE {$dbprefix}survey_{$surveyid} AUTO_INCREMENT = " . $row['autonumber_start'];
$result = $connect->Execute($autonumberquery);
}
}
}
return true;
}
}
示例7: header
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
// Date in the past
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Pragma: cache");
// HTTP/1.0
$xml->openURI('php://output');
}
$xml->setIndent(true);
$xml->startDocument('1.0', 'UTF-8');
$xml->startElement('document');
$xml->writeElement('LimeSurveyDocType', 'Group');
$xml->writeElement('DBVersion', $dbversionnumber);
$xml->startElement('languages');
$lquery = "SELECT language\n FROM {$dbprefix}groups \n WHERE gid={$gid} group by language";
$lresult = db_execute_assoc($lquery);
while ($row = $lresult->FetchRow()) {
$xml->writeElement('language', $row['language']);
}
$xml->endElement();
getXMLStructure($xml, $gid);
$xml->endElement();
// close columns
$xml->endDocument();
exit;
function getXMLStructure($xml, $gid)
{
global $dbprefix, $connect;
// Groups
$gquery = "SELECT *\n FROM {$dbprefix}groups \n WHERE gid={$gid}";
BuildXMLFromQuery($xml, $gquery);
示例8: generate_statistics
/**
* Generates statistics
*
* @param int $surveyid The survey id
* @param mixed $allfields
* @param mixed $q2show
* @param mixed $usegraph
* @param string $outputType Optional - Can be xls, html or pdf - Defaults to pdf
* @param string $pdfOutput Sets the target for the PDF output: DD=File download , F=Save file to local disk
* @param string $statlangcode Lamguage for statistics
* @param mixed $browse Show browse buttons
* @return buffer
*/
function generate_statistics($surveyid, $allfields, $q2show='all', $usegraph=0, $outputType='pdf', $pdfOutput='I',$statlangcode=null, $browse = true)
{
//$allfields ="";
global $connect, $dbprefix, $clang,
$rooturl, $rootdir, $homedir, $homeurl, $tempdir, $tempurl, $scriptname, $imagedir,
$chartfontfile, $chartfontsize, $admintheme, $pdfdefaultfont, $pdffontsize;
$fieldmap=createFieldMap($surveyid, "full");
if (is_null($statlangcode))
{
$statlang=$clang;
}
else
{
$statlang = new limesurvey_lang($statlangcode);
}
/*
* this variable is used in the function shortencode() which cuts off a question/answer title
* after $maxchars and shows the rest as tooltip (in html mode)
*/
$maxchars = 13;
//we collect all the html-output within this variable
$statisticsoutput ='';
/**
* $outputType: html || pdf ||
*/
/**
* get/set Survey Details
*/
//no survey ID? -> come and get one
if (!isset($surveyid)) {$surveyid=returnglobal('sid');}
//Get an array of codes of all available languages in this survey
$surveylanguagecodes = GetAdditionalLanguagesFromSurveyID($surveyid);
$surveylanguagecodes[] = GetBaseLanguageFromSurveyID($surveyid);
// Set language for questions and answers to base language of this survey
$language=$statlangcode;
if ($usegraph==1)
{
//for creating graphs we need some more scripts which are included here
require_once(dirname(__FILE__).'/../classes/pchart/pchart/pChart.class');
require_once(dirname(__FILE__).'/../classes/pchart/pchart/pData.class');
require_once(dirname(__FILE__).'/../classes/pchart/pchart/pCache.class');
$MyCache = new pCache($tempdir.'/');
//pick the best font file if font setting is 'auto'
if ($chartfontfile=='auto')
{
$chartfontfile='vera.ttf';
if ( $language=='ar')
{
$chartfontfile='KacstOffice.ttf';
}
elseif ($language=='fa' )
{
$chartfontfile='KacstFarsi.ttf';
}
}
}
if($q2show=='all' )
{
$summarySql=" SELECT gid, parent_qid, qid, type "
." FROM {$dbprefix}questions WHERE parent_qid=0"
." AND sid=$surveyid ";
$summaryRs = db_execute_assoc($summarySql);
foreach($summaryRs as $field)
{
$myField = $surveyid."X".$field['gid']."X".$field['qid'];
// Multiple choice get special treatment
if ($field['type'] == "M") {$myField = "M$myField";}
if ($field['type'] == "P") {$myField = "P$myField";}
//numerical input will get special treatment (arihtmetic mean, standard derivation, ...)
if ($field['type'] == "N") {$myField = "N$myField";}
if ($field['type'] == "|") {$myField = "|$myField";}
if ($field['type'] == "Q") {$myField = "Q$myField";}
//.........这里部分代码省略.........
示例9: GetSessionUserRights
function GetSessionUserRights($loginID)
{
global $dbprefix, $connect;
$squery = "SELECT create_survey, configurator, create_user, delete_user, superadmin, manage_template, manage_label FROM {$dbprefix}users WHERE uid={$loginID}";
$sresult = db_execute_assoc($squery);
//Checked
if ($sresult->RecordCount() > 0) {
$fields = $sresult->FetchRow();
$_SESSION['USER_RIGHT_CREATE_SURVEY'] = $fields['create_survey'];
$_SESSION['USER_RIGHT_CONFIGURATOR'] = $fields['configurator'];
$_SESSION['USER_RIGHT_CREATE_USER'] = $fields['create_user'];
$_SESSION['USER_RIGHT_DELETE_USER'] = $fields['delete_user'];
$_SESSION['USER_RIGHT_SUPERADMIN'] = $fields['superadmin'];
$_SESSION['USER_RIGHT_MANAGE_TEMPLATE'] = $fields['manage_template'];
$_SESSION['USER_RIGHT_MANAGE_LABEL'] = $fields['manage_label'];
}
// SuperAdmins
// * original superadmin with uid=1 unless manually changed and defined
// in config-defaults.php
// * or any user having USER_RIGHT_SUPERADMIN right
// Let's check if I am the Initial SuperAdmin
$adminquery = "SELECT uid FROM {$dbprefix}users WHERE parent_id=0";
$adminresult = db_select_limit_assoc($adminquery, 1);
$row = $adminresult->FetchRow();
if ($row['uid'] == $_SESSION['loginID']) {
$initialSuperadmin = true;
} else {
$initialSuperadmin = false;
}
if ($initialSuperadmin === true) {
$_SESSION['USER_RIGHT_SUPERADMIN'] = 1;
$_SESSION['USER_RIGHT_INITIALSUPERADMIN'] = 1;
} else {
$_SESSION['USER_RIGHT_INITIALSUPERADMIN'] = 0;
}
}
示例10: die
<?php
if (count($_POST) == 0 && !(isset($subaction) && $subaction == 'navigation_test')) {
die("Cannot run this script directly");
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>LEM Navigation Test</title>
</head>
<body>
<?php
if (count($_POST) == 0) {
$clang = new limesurvey_lang("en");
$query = "select a.surveyls_survey_id as sid, a.surveyls_title as title, b.datecreated, b.assessments " . "from " . db_table_name('surveys_languagesettings') . " as a join " . db_table_name('surveys') . " as b on a.surveyls_survey_id = b.sid" . " where a.surveyls_language='en' order by a.surveyls_title, b.datecreated";
$data = db_execute_assoc($query);
$surveyList = '';
foreach ($data->GetRows() as $row) {
$surveyList .= "<option value='" . $row['sid'] . '|' . $row['assessments'] . "'>#" . $row['sid'] . " [" . $row['datecreated'] . '] ' . FlattenText($row['title']) . "</option>\n";
}
$form = <<<EOD
<form method='post' action='../classes/expressions/test/navigation_test.php'>
<h3>Enter the following variables to test navigation for a survey using different styles</h3>
<table border='1'>
<tr><th>Parameter</th><th>Value</th></tr>
<tr><td>Survey ID (SID)</td>
<td><select name='sid' id='sid'>
{$surveyList}
</select></td></tr>
<tr><td>Navigation Style</td>
<td><select name='surveyMode' id='surveyMode'>
示例11: getQuotaAnswers
function getQuotaAnswers($qid, $surveyid, $quota_id)
{
global $clang;
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$query = "SELECT type, title FROM " . db_table_name('questions') . "q JOIN " . db_table_name('groups') . "g on g.gid=q.gid WHERE qid='{$qid}' AND q.language='{$baselang}' AND g.language='{$baselang}' order by group_order, question_order";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$qtype = $result->FetchRow();
if ($qtype['type'] == 'G') {
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$answerlist = array('M' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Male"), 'code' => 'M'), 'F' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Female"), 'code' => 'F'));
if ($result->RecordCount() > 0) {
while ($quotalist = $result->FetchRow()) {
$answerlist[$quotalist['code']]['rowexists'] = '1';
}
}
}
if ($qtype['type'] == 'M') {
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$query = "SELECT title,question FROM " . db_table_name('questions') . " WHERE parent_qid='{$qid}'";
$ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$answerlist = array();
while ($dbanslist = $ansresult->FetchRow()) {
$tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['question'], 0, 40), 'code' => $dbanslist['title']);
$answerlist[$dbanslist['title']] = $tmparrayans;
}
if ($result->RecordCount() > 0) {
while ($quotalist = $result->FetchRow()) {
$answerlist[$quotalist['code']]['rowexists'] = '1';
}
}
}
if ($qtype['type'] == 'L' || $qtype['type'] == 'O' || $qtype['type'] == '!') {
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$query = "SELECT code,answer FROM " . db_table_name('answers') . " WHERE qid='{$qid}' and language='{$baselang}'";
$ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$answerlist = array();
while ($dbanslist = $ansresult->FetchRow()) {
$answerlist[$dbanslist['code']] = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['answer'], 0, 40), 'code' => $dbanslist['code']);
}
if ($result->RecordCount() > 0) {
while ($quotalist = $result->FetchRow()) {
$answerlist[$quotalist['code']]['rowexists'] = '1';
}
}
}
if ($qtype['type'] == 'A') {
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$query = "SELECT title,question FROM " . db_table_name('questions') . " WHERE parent_qid='{$qid}'";
$ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$answerlist = array();
while ($dbanslist = $ansresult->FetchRow()) {
for ($x = 1; $x < 6; $x++) {
$tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['question'], 0, 40) . ' [' . $x . ']', 'code' => $dbanslist['title']);
$answerlist[$dbanslist['title'] . "-" . $x] = $tmparrayans;
}
}
if ($result->RecordCount() > 0) {
while ($quotalist = $result->FetchRow()) {
$answerlist[$quotalist['code']]['rowexists'] = '1';
}
}
}
if ($qtype['type'] == 'B') {
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$query = "SELECT code,answer FROM " . db_table_name('answers') . " WHERE qid='{$qid}' and language='{$baselang}'";
$ansresult = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$answerlist = array();
while ($dbanslist = $ansresult->FetchRow()) {
for ($x = 1; $x < 11; $x++) {
$tmparrayans = array('Title' => $qtype['title'], 'Display' => substr($dbanslist['answer'], 0, 40) . ' [' . $x . ']', 'code' => $dbanslist['code']);
$answerlist[$dbanslist['code'] . "-" . $x] = $tmparrayans;
}
}
if ($result->RecordCount() > 0) {
while ($quotalist = $result->FetchRow()) {
$answerlist[$quotalist['code']]['rowexists'] = '1';
}
}
}
if ($qtype['type'] == 'Y') {
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
$answerlist = array('Y' => array('Title' => $qtype['title'], 'Display' => $clang->gT("Yes"), 'code' => 'Y'), 'N' => array('Title' => $qtype['title'], 'Display' => $clang->gT("No"), 'code' => 'N'));
if ($result->RecordCount() > 0) {
while ($quotalist = $result->FetchRow()) {
$answerlist[$quotalist['code']]['rowexists'] = '1';
}
}
}
if ($qtype['type'] == 'I') {
$slangs = GetAdditionalLanguagesFromSurveyID($surveyid);
array_unshift($slangs, $baselang);
$query = "SELECT * FROM " . db_table_name('quota_members') . " WHERE sid='{$surveyid}' and qid='{$qid}' and quota_id='{$quota_id}'";
$result = db_execute_assoc($query) or safe_die($connect->ErrorMsg());
while (list($key, $value) = each($slangs)) {
//.........这里部分代码省略.........
示例12: sTokenReturn
/**
*
* function to return unused Tokens as String, seperated by commas, to get the people who did not complete the Survey
* @param $sUser
* @param $sPass
* @param $iVid
* @return unknown_type
*/
function sTokenReturn($sUser, $sPass, $iVid)
{
global $connect;
global $dbprefix;
$ADODB_FETCH_MODE = ADODB_FETCH_ASSOC;
include "lsrc.config.php";
$lsrcHelper = new lsrcHelper();
$lsrcHelper->debugLsrc("wir sind in " . __FUNCTION__ . " Line " . __LINE__ . ", START OK ");
// check for appropriate rights
if (!$lsrcHelper->checkUser($sUser, $sPass)) {
throw new SoapFault("Authentication: ", "User or password wrong");
exit;
}
// check if there is a $iVid, else abort
if (!isset($iVid) || $iVid == '' || $iVid == 0) {
throw new SoapFault("Server: ", "No SurveyId given");
exit;
}
// check if the Survey exists, else -> Fault
if (!$lsrcHelper->surveyExists($iVid)) {
throw new SoapFault("Database: ", "Survey does not exists");
exit;
}
// check if the token table exists, else throw fault message
if (db_tables_exist($dbprefix . "tokens_" . $iVid)) {
// select all the tokens that did not complete the Survey
$query2select_token = "SELECT token from {$dbprefix}tokens_" . $iVid . " WHERE completed = 'N'; ";
$rs = db_execute_assoc($query2select_token);
if ($rs->RecordCount() < 1) {
throw new SoapFault("Database: ", "No unused Tokens found");
exit;
}
$n = 0;
while ($row = $rs->FetchRow()) {
if ($n == 0) {
$sReturn = $row['token'];
} else {
$sReturn .= "," . $row['token'];
}
$n++;
}
// return Response: array([iVid],[return]) on the client side, you get this as an Array resp. list
// the keys in the array, containing the values, are named as defined in the wsdl under the response Message, in this case: array(iVid =>$iVid, return=>$sReturn)
return $sReturn;
exit;
} else {
throw new SoapFault("Database: ", "Token table for this Survey does not exists");
exit;
}
}
示例13: upgrade_surveypermissions_table145
function upgrade_surveypermissions_table145()
{
global $modifyoutput, $connect;
$sPermissionQuery = "SELECT * FROM " . db_table_name('surveys_rights');
$oPermissionResult = db_execute_assoc($sPermissionQuery);
if (!$oPermissionResult) {
return "Database Error";
} else {
$tablename = db_table_name_nq('survey_permissions');
while ($aPermissionRow = $oPermissionResult->FetchRow()) {
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'assessments', 'create_p' => $aPermissionRow['define_questions'], 'read_p' => $aPermissionRow['define_questions'], 'update_p' => $aPermissionRow['define_questions'], 'delete_p' => $aPermissionRow['define_questions'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'quotas', 'create_p' => $aPermissionRow['define_questions'], 'read_p' => $aPermissionRow['define_questions'], 'update_p' => $aPermissionRow['define_questions'], 'delete_p' => $aPermissionRow['define_questions'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'responses', 'create_p' => $aPermissionRow['browse_response'], 'read_p' => $aPermissionRow['browse_response'], 'update_p' => $aPermissionRow['browse_response'], 'delete_p' => $aPermissionRow['delete_survey'], 'export_p' => $aPermissionRow['export'], 'import_p' => $aPermissionRow['browse_response'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'statistics', 'read_p' => $aPermissionRow['browse_response'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'survey', 'read_p' => 1, 'delete_p' => $aPermissionRow['delete_survey'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveyactivation', 'update_p' => $aPermissionRow['activate_survey'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveycontent', 'create_p' => $aPermissionRow['define_questions'], 'read_p' => $aPermissionRow['define_questions'], 'update_p' => $aPermissionRow['define_questions'], 'delete_p' => $aPermissionRow['define_questions'], 'export_p' => $aPermissionRow['export'], 'import_p' => $aPermissionRow['define_questions'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveylocale', 'read_p' => $aPermissionRow['edit_survey_property'], 'update_p' => $aPermissionRow['edit_survey_property'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'surveysettings', 'read_p' => $aPermissionRow['edit_survey_property'], 'update_p' => $aPermissionRow['edit_survey_property'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
$sPermissionInsertQuery = $connect->GetInsertSQL($tablename, array('permission' => 'tokens', 'create_p' => $aPermissionRow['activate_survey'], 'read_p' => $aPermissionRow['activate_survey'], 'update_p' => $aPermissionRow['activate_survey'], 'delete_p' => $aPermissionRow['activate_survey'], 'export_p' => $aPermissionRow['export'], 'import_p' => $aPermissionRow['activate_survey'], 'sid' => $aPermissionRow['sid'], 'uid' => $aPermissionRow['uid']));
modify_database("", $sPermissionInsertQuery);
echo $modifyoutput;
flush();
ob_flush();
}
}
}
示例14: safe_die
if (tableExists("survey_{$surveyid}")) {
$dsquery = $dict->DropTableSQL("{$dbprefix}survey_{$surveyid}");
//$dict->ExecuteSQLArray($sqlarray);
$dsresult = $dict->ExecuteSQLArray($dsquery) or safe_die("Couldn't \"{$dsquery}\" because <br />" . $connect->ErrorMsg());
}
if (tableExists("survey_{$surveyid}_timings")) {
$dsquery = $dict->DropTableSQL("{$dbprefix}survey_{$surveyid}_timings");
//$dict->ExecuteSQLArray($sqlarraytimings);
$dsresult = $dict->ExecuteSQLArray($dsquery) or safe_die("Couldn't \"{$dsquery}\" because <br />" . $connect->ErrorMsg());
}
if (tableExists("tokens_{$surveyid}")) {
$dsquery = $dict->DropTableSQL("{$dbprefix}tokens_{$surveyid}");
$dsresult = $dict->ExecuteSQLArray($dsquery) or safe_die("Couldn't \"{$dsquery}\" because <br />" . $connect->ErrorMsg());
}
$dsquery = "SELECT qid FROM {$dbprefix}questions WHERE sid={$surveyid}";
$dsresult = db_execute_assoc($dsquery) or safe_die("Couldn't find matching survey to delete<br />{$dsquery}<br />" . $connect->ErrorMsg());
while ($dsrow = $dsresult->FetchRow()) {
$asdel = "DELETE FROM {$dbprefix}answers WHERE qid={$dsrow['qid']}";
$asres = $connect->Execute($asdel);
$cddel = "DELETE FROM {$dbprefix}conditions WHERE qid={$dsrow['qid']}";
$cdres = $connect->Execute($cddel) or safe_die("Delete conditions failed<br />{$cddel}<br />" . $connect->ErrorMsg());
$qadel = "DELETE FROM {$dbprefix}question_attributes WHERE qid={$dsrow['qid']}";
$qares = $connect->Execute($qadel);
}
$qdel = "DELETE FROM {$dbprefix}questions WHERE sid={$surveyid}";
$qres = $connect->Execute($qdel);
$scdel = "DELETE FROM {$dbprefix}assessments WHERE sid={$surveyid}";
$scres = $connect->Execute($scdel);
$gdel = "DELETE FROM {$dbprefix}groups WHERE sid={$surveyid}";
$gres = $connect->Execute($gdel);
$slsdel = "DELETE FROM {$dbprefix}surveys_languagesettings WHERE surveyls_survey_id={$surveyid}";
示例15: BuildCSVFromQuery
//9: Question Attributes
$query = "SELECT DISTINCT {$dbprefix}question_attributes.*\n FROM {$dbprefix}question_attributes, {$dbprefix}questions \n\t\t WHERE {$dbprefix}question_attributes.qid={$dbprefix}questions.qid \n\t\t AND {$dbprefix}questions.sid={$surveyid}";
$qadump = BuildCSVFromQuery($query);
//10: Assessments;
$query = "SELECT {$dbprefix}assessments.*\n FROM {$dbprefix}assessments \n\t\t WHERE {$dbprefix}assessments.sid={$surveyid}";
$asdump = BuildCSVFromQuery($query);
//11: Quota;
$query = "SELECT {$dbprefix}quota.*\n FROM {$dbprefix}quota \n\t\t WHERE {$dbprefix}quota.sid={$surveyid}";
$quotadump = BuildCSVFromQuery($query);
//12: Quota Members;
$query = "SELECT {$dbprefix}quota_members.*\n FROM {$dbprefix}quota_members \n\t\t WHERE {$dbprefix}quota_members.sid={$surveyid}";
$quotamemdump = BuildCSVFromQuery($query);
$fn = "limesurvey_survey_{$surveyid}.csv";
//header("Content-Type: application/download");
//header("Content-Disposition: attachment; filename=$fn");
//header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
//header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
//header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
//header("Pragma: cache"); // HTTP/1.0
//include("../config.php");
include_once "../config-defaults.php";
include_once "../common.php";
include "remotecontrol/lsrc.config.php";
$lsrcString = $dumphead . $sdump . $gdump . $qdump . $adump . $cdump . $lsdump . $ldump . $qadump . $asdump . $slsdump . $quotadump . $quotamemdump . "\n";
//Select title as Filename and save
$surveyTitleSql = "SELECT surveyls_title\n\t FROM {$dbprefix}surveys_languagesettings \n\t\t\t\t WHERE surveyls_survey_id={$surveyid}";
$surveyTitleRs = db_execute_assoc($surveyTitleSql);
$surveyTitle = $surveyTitleRs->FetchRow();
file_put_contents("remotecontrol/" . $coreDir . $surveyTitle['surveyls_title'] . ".csv", $lsrcString);
header("Location: {$scriptname}?sid={$surveyid}");
exit;