Have had this mod installed for a few weeks now everything has worked fine. Yet its only now that ive tried to create a new forum that i get an error. This is after filling in forum name, description and pressing 'create new forum'
Code: Select all
Couldn't insert row in forums table
DEBUG MODE
SQL Error : 1136 Column count doesn't match value count at row 1
INSERT INTO phpbb_forums (forum_id, forum_name, cat_id, forum_parent, forum_desc, forum_order, forum_status, forum_digest, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate) VALUES ('57', 'Test Forum', '1', '0', 'Test forum description', 110, 0, 1, 0, '', 0, 0, 0, 0, 0, 0, 0, 1, 1, 3, 3, 1, 1)
Line : 520
File : admin_forums.php
As stated in the error above you can see whats on line 1136
Code: Select all
1132 $template->assign_block_vars("catrow.forumrow", array(
1133 'FORUM_NAME' => $forum_rows[$j]['forum_name'],
1134 'FORUM_DESC' => $forum_rows[$j]['forum_desc'],
1135 'ROW_COLOR' => $row_color,
1136 'NUM_TOPICS' => $forum_rows[$j]['forum_topics'],
1137 'NUM_POSTS' => $forum_rows[$j]['forum_posts'],
Ive narrowed the error trigger to when im told to insert the following code:
Code: Select all
#-----[ FIND ]------------------------------------------
#
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc,
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, prune_enable
#
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
, forum_rules, rules_in_viewforum, rules_in_viewtopic, rules_in_posting
#
#-----[ FIND ]------------------------------------------
#
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "',
#
#-----[ IN-LINE FIND ]------------------------------------------
#
, " . intval($HTTP_POST_VARS['prune_enable'])
#
#
#-----[ IN-LINE AFTER, ADD ]------------------------------------------
#
.", '" . str_replace("\'", "''", $HTTP_POST_VARS['forum_rules']) . "', ". intval($HTTP_POST_VARS['rules_in_viewforum']) . ", ". intval($HTTP_POST_VARS['rules_in_viewtopic']) . ", ". intval($HTTP_POST_VARS['rules_in_posting'])
This is the code
before the mod insert:
Code: Select all
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_parent, forum_desc, forum_order, forum_status, forum_digest, prune_enable" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', '{$new_cat}', '{$new_parent}', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['forum_digest']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
}
This is the code
after the mod insert:
Code: Select all
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_parent, forum_desc, forum_order, forum_status, forum_digest, prune_enable, forum_rules, rules_in_viewforum, rules_in_viewtopic, rules_in_posting" . $field_sql . ")
VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', '{$new_cat}', '{$new_parent}', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['forum_digest']) . ", " . intval($HTTP_POST_VARS['forum_digest']) . ", " . intval($HTTP_POST_VARS['prune_enable']) .", '" . str_replace("\'", "''", $HTTP_POST_VARS['forum_rules']) . "', ". intval($HTTP_POST_VARS['rules_in_viewforum']) . ", ". intval($HTTP_POST_VARS['rules_in_viewtopic']) . ", ". intval($HTTP_POST_VARS['rules_in_posting']) . $value_sql . ")";
if( !$result = $db->sql_query($sql) )
{
message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
}
What do you reckon? Any help appreciated, thanks.