Skip to content

Commit

Permalink
sortorder fixes
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@1962 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Aug 18, 2006
1 parent 15c1aad commit bb6b450
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions common.php
Original file line number Diff line number Diff line change
Expand Up @@ -957,6 +957,25 @@ function fixsortorder($qid) //Function rewrites the sortorder for a group of ans
}
}

function fixsortorderQuestions($qid,$gid=0) //Function rewrites the sortorder for a group of answers
{
global $dbprefix, $connect;
if ($qid != 0)
{
$result = db_execute_assoc("SELECT gid FROM ".db_table_name('questions')." WHERE qid='{$qid}'");
$row=$result->FetchRow();
$cdresult = db_execute_assoc("SELECT qid FROM ".db_table_name('questions')." WHERE gid='{$row['gid']}' ORDER BY question_order, title");
}
$cdresult = db_execute_assoc("SELECT qid FROM ".db_table_name('questions')." WHERE gid='{$gid}' ORDER BY question_order, title");
$position=1;
while ($cdrow=$cdresult->FetchRow())
{
$cd2query="UPDATE ".db_table_name('questions')." SET question_order='{$position}' WHERE qid='{$cdrow['qid']}'";
$cd2result = $connect->Execute($cd2query) or die ("Couldn't update question_order<br />$cd2query<br />".htmlspecialchars($connect->ErrorMsg()));
$position++;
}
}

function browsemenubar()
{
global $surveyid, $scriptname, $imagefiles, $homeurl;
Expand Down

0 comments on commit bb6b450

Please sign in to comment.