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@1966 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Aug 18, 2006
1 parent 8ffdb18 commit 3f22fbe
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion common.php
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,23 @@ function getMaxgrouporder($surveyid)
else return ++$current_max ;
}

/**
* getMaxquestionorder($gid) queries the database for the maximum sortorder of a question.
* @global string $surveyid
*/
function getMaxquestionorder($gid)
{
global $surveyid ;
$max_sql = "SELECT max( question_order ) AS max FROM questions WHERE gid='$gid'" ;
$max_result =db_execute_assoc($max_sql) ;
$maxrow = $max_result->FetchRow() ;
$current_max = $maxrow['max'];
if($current_max=="")
{
return "0" ;
}
else return ++$current_max ;
}

/**
* getanswers() queries the database for a list of all answers matching the current question qid
Expand Down Expand Up @@ -980,7 +997,7 @@ function fixsortorderQuestions($qid,$gid=0) //Function rewrites the sortorder fo
function fixsortorderGroups() //Function rewrites the sortorder for questions
{
global $dbprefix, $connect;
$cdresult = db_execute_assoc("SELECT gid FROM ".db_table_name('groups')." WHERE gid='{$gid}' ORDER BY group_order, group_name");
$cdresult = db_execute_assoc("SELECT gid FROM ".db_table_name('groups')." ORDER BY group_order, group_name");
$position=1;
while ($cdrow=$cdresult->FetchRow())
{
Expand Down

0 comments on commit 3f22fbe

Please sign in to comment.