Update of /cvsroot/stack/stack-1-0/scripts
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25899/scripts
Modified Files:
stackDatabase.php
Log Message:
Index: stackDatabase.php
===================================================================
RCS file: /cvsroot/stack/stack-1-0/scripts/stackDatabase.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** stackDatabase.php 30 Aug 2005 13:51:54 -0000 1.37
--- stackDatabase.php 30 Aug 2005 14:29:25 -0000 1.38
***************
*** 516,528 ****
* @return int $result the questionID of the question in the database, new or not.
*/
! function stack_db_question_add($question,$newq=FALSE)
! { // Add a question to the DB.
! // If a question has an ID number, and $newq = FALSE, then we update the existing question.
! // Otherwise we store it as a new question.
global $stackQuestion,$stack_web_url;
// Take the first 30 chars from the question stem
$pdes = substr($question['questionStem'],0,30);
-
- //If the description is empty, add the first 30 characters of the stem.
if (array_key_exists('questionDescription',$question)) {
if ('' == $question['questionDescription']) {
--- 516,525 ----
* @return int $result the questionID of the question in the database, new or not.
*/
! function stack_db_question_add($question,$newq=FALSE) {
global $stackQuestion,$stack_web_url;
+
// Take the first 30 chars from the question stem
+ // If the description is empty, add the first 30 characters of the stem.
$pdes = substr($question['questionStem'],0,30);
if (array_key_exists('questionDescription',$question)) {
if ('' == $question['questionDescription']) {
***************
*** 589,593 ****
$qu_fields = substr($qu_fields, 1); //Strip initial comma
! $qu_data = substr($qu_data, 1);
// Build the query
--- 586,590 ----
$qu_fields = substr($qu_fields, 1); //Strip initial comma
! $qu_data = substr($qu_data, 1);
// Build the query
***************
*** 669,673 ****
global $stackQuestion,$stack_mysql;
! $query='SELECT * FROM stackQuestion WHERE questionID='.$questionID;
$result= stack_db_query($query);
--- 666,679 ----
global $stackQuestion,$stack_mysql;
! foreach ($stackQuestion as $qfield => $val) {
! if ('meta' == $val['type']) {
! $qfields[] = $qfield;
! $query .= ' ,'.$qfield;
! }
! }
! $query = substr($query,2,strlen($query)-2);
!
! $query='SELECT '.$query.' FROM stackQuestion WHERE questionID='.$questionID;
!
$result= stack_db_query($query);
***************
*** 679,690 ****
$row = mysql_fetch_row($result);
- $qfields = array();
- // Form a list of the data fields in a question
- foreach( $stackQuestion as $qfield => $val) {
- if ( 'meta' == $stackQuestion[$qfield]['type']) {
- $qfields[]=$qfield;
- }
- }
-
foreach( $qfields as $qf => $val) {
// Extract the infomation
--- 685,688 ----
***************
*** 1686,1690 ****
if (0 == $result) {
! return false;
}
--- 1684,1688 ----
if (0 == $result) {
! return false;
}
|