Forum Replies Created

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter khawaja1971

    (@khawaja1971)

    The previous WHERE clause in the REPLACE INTO statement was trying to find data that did not exist and thus updating nothing.

    It still shows an error: There was an error in your submission, please try again. The attendee was not saved!

    But the new data is being inserted.

    Thread Starter khawaja1971

    (@khawaja1971)

    I probably solved my own problem. A chunk of code using the REPLACE INTO operator was not being used properly.

    part of evr_admin_attendee_update.php was edited to the following:

    switch ($question->question_type) {
                				case "TEXT" :
                				case "TEXTAREA" :
                				case "DROPDOWN" :
                					$post_val = $_POST [$question->question_type . '_' . $question->id];
                					$sql = "REPLACE INTO " . get_option('evr_answer') . " (registration_id, question_id, answer) VALUES ('$reg_id', '$question->id', '$post_val')";
                					$wpdb->query ($sql);
                					break;
                				case "SINGLE" :
                					$post_val = $_POST [$question->question_type . '_' . $question->id];
                					$sql = "REPLACE INTO " . get_option('evr_answer') . " (registration_id, question_id, answer) VALUES ('$reg_id', '$question->id', '$post_val')";
                					$wpdb->query ($sql);
                					break;
                				case "MULTIPLE" :
                					$value_string = '';
                					for ($i=0; $i<count($_POST[$question->question_type.'_'.$question->id]); $i++){
                					$value_string .= $_POST[$question->question_type.'_'.$question->id][$i].",";
                					}
                					$sql = "REPLACE INTO " . get_option('evr_answer') . " (registration_id, question_id, answer) VALUES ('$reg_id', '$question->id', '$value_string')";
                					$wpdb->query ($sql);
                					break;
                			}
            }
Viewing 2 replies - 1 through 2 (of 2 total)