Topic: problems with modifying phpbb forum (Read 1241 times)
aka J Love Community Supporter?
Bill Gates is my home boy
Gender:
Posts: 886
1148 credits Members referred : 4
« on: Apr 08, 2006, 10:38:18 pm »
i am installing a mod for phpbb, if you are familiar with it, it comes from phpbbhacks.com. when trying to create a new forum after making the necessary changes, it disallows me from creating the forum due to a mysql error. here is the error mysql gives us:
Quote
General Error Couldn't insert row in forums table
DEBUG MODE
SQL Error : 1136 Column count doesn't match value count at row 1
/*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/
if( $mode == "addforum" ) { list($cat_id) = each($HTTP_POST_VARS['addforum']); $cat_id = intval($cat_id); // // stripslashes needs to be run on this because slashes are added when the forum name is posted // $forumname = stripslashes($HTTP_POST_VARS['forumname'][$cat_id]); } }
if( !empty($mode) ) { switch($mode) { case 'addforum': case 'editforum': // // Show form to create/modify a forum // if ($mode == 'editforum') { // $newmode determines if we are going to INSERT or UPDATE after posting?
case 'createforum': // // Create a forum in the DB // if( trim($HTTP_POST_VARS['forumname']) == "" ) { message_die(GENERAL_ERROR, "Can't create a forum without a name"); }
$sql = "SELECT MAX(forum_order) AS max_order FROM " . FORUMS_TABLE . " WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]); if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result);
$max_order = $row['max_order']; $next_order = $max_order + 10; $sql = "SELECT MAX(forum_id) AS max_id FROM " . FORUMS_TABLE; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result);
case 'modforum': // Modify a forum in the DB if( isset($HTTP_POST_VARS['prune_enable'])) { if( $HTTP_POST_VARS['prune_enable'] != 1 ) { $HTTP_POST_VARS['prune_enable'] = 0; } }
break; 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);
// // There is no problem having duplicate forum names so we won't check for it. // $sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order) VALUES ('" . str_replace("\'", "''", $HTTP_POST_VARS['categoryname']) . "', $next_order)"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't insert row in categories table", "", __LINE__, __FILE__, $sql); }
case 'movedelforum': // // Move or delete a forum in the DB // $from_id = intval($HTTP_POST_VARS['from_id']); $to_id = intval($HTTP_POST_VARS['to_id']); $delete_old = intval($HTTP_POST_VARS['delete_old']);
// Either delete or move all posts in a forum if($to_id == -1) { // Delete polls in this forum $sql = "SELECT v.vote_id FROM " . VOTE_DESC_TABLE . " v, " . TOPICS_TABLE . " t WHERE t.forum_id = $from_id AND v.topic_id = t.topic_id"; if (!($result = $db->sql_query($sql))) { message_die(GENERAL_ERROR, "Couldn't obtain list of vote ids", "", __LINE__, __FILE__, $sql); }
if ($row = $db->sql_fetchrow($result)) { $vote_ids = ''; do { $vote_ids = (($vote_ids != '') ? ', ' : '') . $row['vote_id']; } while ($row = $db->sql_fetchrow($result));
$sql = "DELETE FROM " . VOTE_DESC_TABLE . " WHERE vote_id IN ($vote_ids)"; $db->sql_query($sql);
$sql = "DELETE FROM " . VOTE_RESULTS_TABLE . " WHERE vote_id IN ($vote_ids)"; $db->sql_query($sql);
$sql = "DELETE FROM " . VOTE_USERS_TABLE . " WHERE vote_id IN ($vote_ids)"; $db->sql_query($sql); } $db->sql_freeresult($result); include($phpbb_root_path . "includes/prune.$phpEx"); prune($from_id, 0, true); // Delete everything from forum } else { $sql = "SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id IN ($from_id, $to_id)"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't verify existence of forums", "", __LINE__, __FILE__, $sql); }
case 'movedelcat': // // Move or delete a category in the DB // $from_id = intval($HTTP_POST_VARS['from_id']); $to_id = intval($HTTP_POST_VARS['to_id']);
if (!empty($to_id)) { $sql = "SELECT * FROM " . CATEGORIES_TABLE . " WHERE cat_id IN ($from_id, $to_id)"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't verify existence of categories", "", __LINE__, __FILE__, $sql); } if($db->sql_numrows($result) != 2) { message_die(GENERAL_ERROR, "Ambiguous category ID's", "", __LINE__, __FILE__); }
$sql = "UPDATE " . FORUMS_TABLE . " SET cat_id = $to_id WHERE cat_id = $from_id"; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't move forums to other category", "", __LINE__, __FILE__, $sql); } }
case 'forum_order': // // Change order of forums in the DB // $move = intval($HTTP_GET_VARS['move']); $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);
break; case 'cat_order': // // Change order of categories in the DB // $move = intval($HTTP_GET_VARS['move']); $cat_id = intval($HTTP_GET_VARS[POST_CAT_URL]);
/*************************************************************************** * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * ***************************************************************************/
if( $mode == "addforum" ) { list($cat_id) = each($HTTP_POST_VARS['addforum']); $cat_id = intval($cat_id); // // stripslashes needs to be run on this because slashes are added when the forum name is posted // $forumname = stripslashes($HTTP_POST_VARS['forumname'][$cat_id]); } }
if( !empty($mode) ) { switch($mode) { case 'addforum': case 'editforum': // // Show form to create/modify a forum // if ($mode == 'editforum') { // $newmode determines if we are going to INSERT or UPDATE after posting?
case 'createforum': // // Create a forum in the DB // if( trim($HTTP_POST_VARS['forumname']) == "" ) { message_die(GENERAL_ERROR, "Can't create a forum without a name"); }
$sql = "SELECT MAX(forum_order) AS max_order FROM " . FORUMS_TABLE . " WHERE cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]); if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result);
$max_order = $row['max_order']; $next_order = $max_order + 10; $sql = "SELECT MAX(forum_id) AS max_id FROM " . FORUMS_TABLE; if( !$result = $db->sql_query($sql) ) { message_die(GENERAL_ERROR, "Couldn't get order number from forums table", "", __LINE__, __FILE__, $sql); } $row = $db->sql_fetchrow($result);