Seite 1 von 1

edit Umfrage schlägt fehl - Mehrfachumfrage

Verfasst: 18.05.2003 12:19
von Lippo
Sooooo ... ich habe erstens ein Problem und zweitens möchte ich noch etwas ändern ... ich habe gestern einen neuen Mod eingebaut (Hier zu finden: http://www.phpbb.com/phpBB/viewtopic.ph ... =multivote) ... er funktioniert eigentlich auch bestens, will heißen ich kann einen Poll mit vollem Funktionsumfang erstellen und dieser funktioniert auch ... wenn ich nun jedoch versuche diese Umfrage zu editieren, so erscheint nach dem absenden folgende Fehlermeldung:

Error in posting

DEBUG MODE

SQL Error : 1196 Warning: Some non-transactional changed tables couldn't be rolled back

UPDATE phpbb_vote_desc SET vote_text = 'xxx ???', vote_length, = 0 , vote_max = '2', vote_hide = '', vote_tothide = '' WHERE topic_id = 37

Line : 300
File : /usr/local/httpd/htdocs/kunden/cbn1321/html/phpforum/includes/functions_post.php


Ich werde im folgenden nochmal die Zeile 300 aus der angebenen Datei einfügen ...

Code: Alles auswählen

	//
	// Add poll
	// 
	if (($mode == 'newtopic' || ($mode == 'editpost' && $post_data['edit_poll'])) && !empty($poll_title) && count($poll_options) >= 2)
	{
		$sql = (!$post_data['has_poll']) ? "INSERT INTO " . VOTE_DESC_TABLE . " (topic_id, vote_text, vote_start, vote_length, vote_max, vote_hide, vote_tothide) VALUES ($topic_id, '$poll_title', $current_time, " . ($poll_length * 86400) . " , '$max_vote', '$hide_vote', '$tothide_vote')" : "UPDATE " . VOTE_DESC_TABLE . " SET vote_text = '$poll_title', vote_length, = " . ($poll_length * 86400) . " , vote_max = '$max_vote', vote_hide = '$hide_vote', vote_tothide = '$tothide_vote' WHERE topic_id = $topic_id";
		if (!$db->sql_query($sql))
		{
300~>			message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
		}

		$delete_option_sql = '';
		$old_poll_result = array();
		if ($mode == 'editpost' && $post_data['has_poll'])
		{
			$sql = "SELECT vote_option_id, vote_result  
				FROM " . VOTE_RESULTS_TABLE . " 
				WHERE vote_id = $poll_id 
				ORDER BY vote_option_id ASC";
			if (!($result = $db->sql_query($sql)))
			{
				message_die(GENERAL_ERROR, 'Could not obtain vote data results for this topic', '', __LINE__, __FILE__, $sql);
			}

			while ($row = $db->sql_fetchrow($result))
			{
				$old_poll_result[$row['vote_option_id']] = $row['vote_result'];

				if (!isset($poll_options[$row['vote_option_id']]))
				{
					$delete_option_sql .= ($delete_option_sql != '') ? ', ' . $row['vote_option_id'] : $row['vote_option_id'];
				}
			}
		}
		else
		{
			$poll_id = $db->sql_nextid();
		}

		@reset($poll_options);

		$poll_option_id = 1;
		while (list($option_id, $option_text) = each($poll_options))
		{
			if (!empty($option_text))
			{
				$option_text = str_replace("\'", "''", htmlspecialchars($option_text));
				$poll_result = ($mode == "editpost" && isset($old_poll_result[$option_id])) ? $old_poll_result[$option_id] : 0;

				$sql = ($mode != "editpost" || !isset($old_poll_result[$option_id])) ? "INSERT INTO " . VOTE_RESULTS_TABLE . " (vote_id, vote_option_id, vote_option_text, vote_result) VALUES ($poll_id, $poll_option_id, '$option_text', $poll_result)" : "UPDATE " . VOTE_RESULTS_TABLE . " SET vote_option_text = '$option_text', vote_result = $poll_result WHERE vote_option_id = $option_id AND vote_id = $poll_id";
				if (!$db->sql_query($sql))
				{
					message_die(GENERAL_ERROR, 'Error in posting', '', __LINE__, __FILE__, $sql);
				}
				$poll_option_id++;
			}
		}

		if ($delete_option_sql != '')
		{
			$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . " 
				WHERE vote_option_id IN ($delete_option_sql) 
					AND vote_id = $poll_id";
			if (!$db->sql_query($sql))
			{
				message_die(GENERAL_ERROR, 'Error deleting pruned poll options', '', __LINE__, __FILE__, $sql);
			}
		}
	}

	$meta = '<meta http-equiv="refresh" content="3;url=' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">';
	$message = $lang['Stored'] . '<br /><br />' . sprintf($lang['Click_view_message'], '<a href="' . append_sid("viewtopic.$phpEx?" . POST_POST_URL . "=" . $post_id) . '#' . $post_id . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_forum'], '<a href="' . append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">', '</a>');

	return false;
}
Zeile 300 ist mit einem 300~> am Anfang makiert ... dieses 300~> ist natürlich nicht wirklich im Quellcode enthalten ... jetzt noch zu einer kleinen erweiterung bzw. umänderung des Mods ...

Ich möchte eine gewichtete Umfrage veranstalten können und das Häkchen-Prinzip ist hierzu nicht in der Lage ... es müsste also ein Stimmen-Counter her, der anzeigt wieviele Stimmen man noch hat und nach jedem Vote erscheint wieder die Umfrage mit Auswahlmöglichkeiten, nur halt mit -1 auf dem Stimmen-Counter ... somit hätten die Mitglieder die Möglichkeit mehrmals die gleiche Antwort zu wählen und ihr somit mehr gewicht zuordnen ... nur wie stellt man sowas an :-?

Lippo :(

Verfasst: 18.05.2003 13:33
von Lippo
Also ... das Problem hätte ich gelöst ... mein Änderungs-Bedarf zu einer gewichteten Umfrage jedoch noch nicht ... und ausserdem versuche ich gerade wieder die Umfrage-Geschlossen Funktion wieder einzubauen, die auch durch den neuen Mod untauglich gemacht wurde ...