From: Chris S. <san...@us...> - 2005-08-30 14:47:01
|
Update of /cvsroot/stack/stack-1-0/scripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30617/scripts Modified Files: stackDatabase.php Log Message: Index: stackDatabase.php =================================================================== RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v retrieving revision 1.38 retrieving revision 1.39 diff -C2 -d -r1.38 -r1.39 *** stackDatabase.php 30 Aug 2005 14:29:25 -0000 1.38 --- stackDatabase.php 30 Aug 2005 14:46:54 -0000 1.39 *************** *** 1190,1195 **** $user = FALSE; $stackUserKeys = array_keys($stackUser); ! ! $query = "SELECT * FROM stackUser WHERE username = '$username'"; $result = stack_db_query($query); --- 1190,1199 ---- $user = FALSE; $stackUserKeys = array_keys($stackUser); ! ! foreach ($stackUserKeys as $val) { ! $query .= ' ,'.$val; ! } ! $query = substr($query,2,strlen($query)-2); ! $query = "SELECT $query FROM stackUser WHERE username = '$username'"; $result = stack_db_query($query); *************** *** 1384,1391 **** $quiz_list = NULL; $quiz_fields = array_keys($stackQuiz); if ('' == $quizid) { ! $query = "SELECT * FROM stackQuiz"; } else { ! $query = "SELECT * FROM stackQuiz WHERE quizid = '$quizid'"; } $result = stack_db_query($query); --- 1388,1401 ---- $quiz_list = NULL; $quiz_fields = array_keys($stackQuiz); + + foreach ($quiz_fields as $val) { + $query .= ' ,'.$val; + } + $query = substr($query,2,strlen($query)-2); + if ('' == $quizid) { ! $query = "SELECT $query FROM stackQuiz"; } else { ! $query = "SELECT $query FROM stackQuiz WHERE quizid = '$quizid'"; } $result = stack_db_query($query); *************** *** 1530,1544 **** * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! ! * @param int $qord The order of the question in the quiz, optional * @return void */ function stack_db_quiz_add_question($quizid,$questionID,$qord='NULL') { ! if ($qord==='NULL') $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; ! ! else ! $query = "INSERT INTO quiz_question (quizid, questionID, qord) VALUES ('$quizid','$questionID','$qord')"; ! $result = stack_db_query($query); } --- 1540,1554 ---- * @param int $quizid The quizid number of the quiz needed. * @param int $questionID The questionID of the question! ! * @param int $qord The order of the question in the quiz, optional * @return void */ function stack_db_quiz_add_question($quizid,$questionID,$qord='NULL') { ! if ($qord==='NULL') $query = "INSERT INTO quiz_question (quizid, questionID) VALUES ('$quizid','$questionID')"; ! ! else ! $query = "INSERT INTO quiz_question (quizid, questionID, qord) VALUES ('$quizid','$questionID','$qord')"; ! $result = stack_db_query($query); } |