Seite 1 von 1

[Problem] Categories & Forums icons

Verfasst: 02.04.2005 20:11
von Firestarter
Hi Leute,

ich hab mal wieder ein kleines Problem bei Einbau von Categories & Forums icons und zwar stellt sich das Problem so dar, das der Mod mir folgende Fehlermeldung auswirft, wenn ich neue Kategorien oder Foren erstellen möchte =>

Code: Alles auswählen

Couldn't insert row in categories table

DEBUG MODE

SQL Error : 1064 You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ')' at line 2

INSERT INTO phpbb_categories (cat_title, cat_order, cat_icon) VALUES ('testbox', 60, )

Line : 511
File : admin_forums.php
der entsprechende Teil sieht aber nach der Anleitung so aus =>

Code: Alles auswählen

case 'addcat':
			// Create a category in the DB
			if( trim($HTTP_POST_VARS['categoryname']) == '')
			{
				message_die(GENERAL_ERROR, "Can't create a category without a name");
			}

			$sql = "SELECT MAX(cat_order) AS max_order
				FROM " . CATEGORIES_TABLE;
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't get order number from categories table", "", __LINE__, __FILE__, $sql);
			}
			$row = $db->sql_fetchrow($result);

			$max_order = $row['max_order'];
			$next_order = $max_order + 10;

			//
			// There is no problem having duplicate forum names so we won't check for it.
			//
			$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order, cat_icon)
				VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order, $caticon)";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");

			message_die(GENERAL_MESSAGE, $message);

			break;

		case 'editcat':
			//
			// Show form to edit a category
			//
			$newmode = 'modcat';
			$buttonvalue = $lang['Update'];

			$cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);

			$row = get_info('category', $cat_id);
			$cat_title = $row['cat_title'];
			$caticon = $row['cat_icon'];

			$template->set_filenames(array(
				"body" => "admin/category_edit_body.tpl")
			);

			$s_hidden_fields = '<input type="hidden" name="mode" value="' . $newmode . '" /><input type="hidden" name="' . POST_CAT_URL . '" value="' . $cat_id . '" />';

			$template->assign_vars(array(
				'CAT_TITLE' => $cat_title,
				'CAT_ICON' => $caticon,
                'L_ICON' => $lang['Icon'],

				'L_EDIT_CATEGORY' => $lang['Edit_Category'],
				'L_EDIT_CATEGORY_EXPLAIN' => $lang['Edit_Category_explain'],
				'L_CATEGORY' => $lang['Category'],

				'S_HIDDEN_FIELDS' => $s_hidden_fields,
				'S_SUBMIT_VALUE' => $buttonvalue,
				'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"))
			);

			$template->pparse("body");
			break;
Komischerweise geht es, wenn ich die Einstellungen für diesen Mod herausnehme und Erstellung einer Kategorie dann wirder das Skript mit den Modänderungen benutze, Images werden eingetragen und angezeigt.

Kann mir jemand sagen, was dort schief läuft?????

Verfasst: 02.04.2005 20:53
von rabbit
verlinke doch mal die ganze datei hier... :)

Verfasst: 07.04.2005 22:45
von Firestarter
haste mal ein Webspace oder gibt mir ein Mod die Freigabe für den Post eines kompletten Codes der Datei ?

Verfasst: 07.04.2005 23:05
von rabbit
dann markiere doch mal die zeile 511.

Verfasst: 07.04.2005 23:27
von Firestarter

Code: Alles auswählen

//
			// There is no problem having duplicate forum names so we won't check for it.
			//
			$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order, cat_icon)
				VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order, $caticon)";
			if( !$result = $db->sql_query($sql) )
			{
				message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql);
			}

			$message = $lang['Forums_updated'] . "<br /><br />" . sprintf($lang['Click_return_forumadmin'], "<a href=\"" . append_sid("admin_forums.$phpEx") . "\">", "</a>") . "<br /><br />" . sprintf($lang['Click_return_admin_index'], "<a href=\"" . append_sid("index.$phpEx?pane=right") . "\">", "</a>");
Zeile 511=> message_die(GENERAL_MESSAGE, $message);

Code: Alles auswählen

break;

Verfasst: 07.04.2005 23:57
von rabbit
mir scheint, du hast dies:

Code: Alles auswählen

------------------------------
[FIND]:
$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order)
				VALUES ('" . $HTTP_POST_VARS['categoryname'] . "', $next_order)";


[REPLACE]:
$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order, cat_icon) 
            VALUES ('" . $HTTP_POST_VARS['categoryname'] . "', $next_order, $caticon)";
und dies:

Code: Alles auswählen

------------------------------
[FIND]:
// Modify a category in the DB
$sql = "UPDATE " . CATEGORIES_TABLE . "
	SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "' 
	WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);

[REPLACE]:
$sql = "UPDATE " . CATEGORIES_TABLE . "
	SET cat_title = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_title']) . "', cat_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['cat_icon']) . "' 
	WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]);
durcheinandergebracht.

der befehl bei dir sagt INSERT INTO, aber die anweisungen sind aus dem UPDATE-befehl... :-?
bzw. wo ist das:

Code: Alles auswählen

VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "',
her? :-?

Verfasst: 08.04.2005 05:40
von Firestarter
hmmm... okay, dann werde ich am WE mal die Datei neu machen, vielleicht geht es dann, THX für die Info.