Log in Register FAQ Memberlist Search Welcome to RCF - WHF Forum Index
alt : test.swf
Welcome to RCF - WHF
4fx3.gif 
calendar_open_closeCalendar 
Error I can't troubleshoot
Post new topic   Reply to topic View previous topic :: View next topic
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support Add To Bookmarks
Error I can't troubleshoot
PostPosted: 07/07/2007 9:08 AM Reply with quote
Caravan
FTM
Caravan
Posts 282
Word Cnt. 31,380
BDay Apr 14
Sign Aries
Sex Sex:Female
Joined: Nov 01, 2006
Local time: 10:29 PM
Location: Denver, PA
usaCa.gif
Hi Nightrider, so glad to see you back, I hope your feeling well!

I have someone asking me for some help with an error. I have checked where it is failing, and I think I know what mod it is from, but I don't know what to do to fix it. I was hoping you could point me in the right direction.

The error happens when you try to create a new forum.

Code:

Couldn't insert row in forums table

DEBUG MODE

INSERT INTO phpbb_forums (forum_id, forum_name, forum_icon, cat_id, forum_desc, forum_order, forum_status, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit, auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate) VALUES ('22', 'CELEBRATING OUR VETERANS', '', 3, 'A place for those veteran photos', 90, 0, 0, 0, 0, 1, 1, 1, 1, 3, 3, 1, 1)

Line : 408
File : admin_forums.php


I looked up the spot it's failing and that is as follows.

Code:

// There is no problem having duplicate forum names so we won't check for it.
         $sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, forum_icon, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
            VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

         {
            message_die(GENERAL_ERROR, "Couldn't insert row in forums table", "", __LINE__, __FILE__, $sql);
         }


And it seems to be from this mod, in the admin_forums edit.

Code:

###############################################
##
## MOD Title:   Categories & Forum Icon
## MOD Version: 1.0.0
## Author: Anh Le Minh < >
## Website: http://www.netanh.com
## Forum: http://forum.netanh.com
## Description: This Mod gives 1 images beside your categories name, forum name on
## index page
##
## Files To Edit: 7
##                language/lang_xxx/lang_main.php
##                language/lang_xxx/lang_admin.php
##                admin/admin_forums.php
##                templates/YOUR_TEMPLATE/admin/forum_edit_body.tpl
##                templates/YOUR_TEMPLATE/admin/category_edit_body.tpl
##                templates/YOUR_TEMPLATE/index_body.tpl
##                index.php
## Installation Time:   10-15 Minutes
## Included Files:      none
##
###################################################################### #############
##
## Installation/Author Notes:
## First always make a back-up from the files that
## you're going to edit.
##
## This add-on MOD adds a few field to your 'forums' & 'categories' table.
###################################################################### #############

#
#-----[ ACTION: EXECUTE]-----------------------------------
#
#
SQL QUERY:
ALTER TABLE prefix_forums ADD forum_icon VARCHAR(100);
ALTER TABLE prefix_categories ADD cat_icon VARCHAR(100);

#
#-----[ ACTION: ]------------------------------------------
# OPEN: language/lang_xxx/lang_main.php

[FIND]:
//
// That's all Folks!

[ADD AFTER]:

// Categories & Forum icon MOD
$lang['Icon'] = "Icon";

####### SAVE & CLOSE: language/lang_xxx/lang_main.php #######
#############################################################


#
#-----[ ACTION: ]------------------------------------------
# OPEN: language/lang_xxx/lang_admin.php

[FIND]:
//
// That's all Folks!

[ADD AFTER]:

// Categories & Forum icon MOD
$lang['Icon'] = "Icon";

####### SAVE & CLOSE: language/lang_xxx/lang_admin.php #######
#############################################################


#
#-----[ ACTION: ]------------------------------------------
# OPEN: admin\admin_forums.php

[FIND]:
case 'editforum':
         //
         // Show form to create/modify a forum
         //
         if ($mode == 'editforum')
         {
            // $newmode determines if we are going to INSERT or UPDATE after posting?

            $l_title = $lang['Edit_forum'];
            $newmode = 'modforum';
            $buttonvalue = $lang['Update'];

            $forum_id = intval($HTTP_GET_VARS[POST_FORUM_URL]);

            $row = get_info('forum', $forum_id);

            $cat_id = $row['cat_id'];
            $forumname = $row['forum_name'];
            $forumdesc = $row['forum_desc'];
            $forumstatus = $row['forum_status'];
[ADD AFTER]:
$forumicon = $row['forum_icon'];

------------------------------
[FIND]:
$forumdesc = '';

[ADD AFTER]:
$forumicon = '';

------------------------------
[FIND]:
'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],

[ADD AFTER]:
'L_ICON' => $lang['Icon'],

------------------------------
[FIND]:
'DESCRIPTION' => $forumdesc)

[REPLACE WITH]:
'DESCRIPTION' => $forumdesc,
'F_ICON' => $forumicon)

------------------------------
[FIND]:
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
            VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";

[REPLACE]:
$sql = "INSERT INTO " . FORUMS_TABLE . " (forum_id, forum_name, forum_icon, cat_id, forum_desc, forum_order, forum_status, prune_enable" . $field_sql . ")
            VALUES ('" . $next_id . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', $next_order, " . intval($HTTP_POST_VARS['forumstatus']) . ", " . intval($HTTP_POST_VARS['prune_enable']) . $value_sql . ")";


------------------------------
[FIND]:
$sql = "UPDATE " . FORUMS_TABLE . "
            SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
            WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);


[REPLACE]:
$sql = "UPDATE " . FORUMS_TABLE . "
            SET forum_name = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumname']) . "', cat_id = " . intval($HTTP_POST_VARS[POST_CAT_URL]) . ", forum_desc = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumdesc']) . "', forum_icon = '" . str_replace("\'", "''", $HTTP_POST_VARS['forumicon']) . "', forum_status = " . intval($HTTP_POST_VARS['forumstatus']) . ", prune_enable = " . intval($HTTP_POST_VARS['prune_enable']) . "
            WHERE forum_id = " . intval($HTTP_POST_VARS[POST_FORUM_URL]);


------------------------------
[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)";

------------------------------
[FIND]:
$cat_title = $row['cat_title'];

[ADD AFTER]:
$caticon = $row['cat_icon'];


------------------------------
[FIND]:
'CAT_TITLE' => $cat_title,

[ADD AFTER]:
'CAT_ICON' => $caticon,
'L_ICON' => $lang['Icon'],


------------------------------
[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]);


------------------------------
[FIND]:
$name = $catinfo['cat_title'];

[ADD AFTER]:
$caticon = $catinfo['cat_icon'];

####### SAVE & CLOSE: admin\admin_forums.php #######
#############################################################

#
#-----[ ACTION: ]------------------------------------------
# OPEN: index.php

[FIND]:
//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order
   FROM " . CATEGORIES_TABLE . " c

[REPLACE]:
//
// Start page proper
//
$sql = "SELECT c.cat_id, c.cat_title, c.cat_order, c.cat_icon
   FROM " . CATEGORIES_TABLE . " c

------------------------------
[FIND]:
if ( $display_forums )
      {
         $template->assign_block_vars('catrow', array(
            'CAT_ID' => $cat_id,
            'CAT_DESC' => $category_rows[$i]['cat_title'],
            'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
         );

[REPLACE]:
if ( $display_forums )
      {
            if ($category_rows[$i]['cat_icon'] != '')
            {$c_icon = '&nbsp;<img src="'.$category_rows[$i]['cat_icon'].'"/>&nbsp;';}
                                else {$c_icon = '';}
         $template->assign_block_vars('catrow', array(
            'CAT_ID' => $cat_id,
            'CAT_DESC' => $category_rows[$i]['cat_title'],
            'CAT_ICON' => $c_icon,
            'U_VIEWCAT' => append_sid("index.$phpEx?" . POST_CAT_URL . "=$cat_id"))
         );


------------------------------
[FIND]:
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
                     
$template->assign_block_vars('catrow.forumrow',   array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_ID' => $forum_data[$j]['forum_id'],
'FORUM_NAME' => $forum_data[$j]['forum_name'],
'FORUM_DESC' => $forum_data[$j]['forum_desc'],
'POSTS' => $forum_data[$j]['forum_posts'],
'TOPICS' => $forum_data[$j]['forum_topics'],


[REPLACE]:
$row_color = ( !($i % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($i % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
if ($forum_data[$j]['forum_icon'] != '')
{$f_icon = '&nbsp;<img src="'.$forum_data[$j]['forum_icon'].'">&nbsp;';}
else {$f_icon = '';}

$template->assign_block_vars('catrow.forumrow',   array(
'ROW_COLOR' => '#' . $row_color,
'ROW_CLASS' => $row_class,
'FORUM_FOLDER_IMG' => $folder_image,
'FORUM_ID' => $forum_data[$j]['forum_id'],
'FORUM_NAME' => $forum_data[$j]['forum_name'],
'FORUM_DESC' => $forum_data[$j]['forum_desc'],
'FORUM_ICON' => $f_icon,
'POSTS' => $forum_data[$j]['forum_posts'],
'TOPICS' => $forum_data[$j]['forum_topics'],

####### SAVE & CLOSE: index.php #######
#############################################################


#
#-----[ ACTION: ]------------------------------------------
# OPEN: templates\subSilver\admin\forum_edit_body.tpl

[FIND]:
   <tr>
     <td class="row1">{L_FORUM_DESCRIPTION}</td>
     <td class="row2"><textarea rows="5" cols="45" wrap="virtual" name="forumdesc" class="post">{DESCRIPTION}</textarea></td>
   </tr>

[ADD AFTER]:
<tr>
   <td class="row1">{L_ICON}</td>
   <td class="row2"><input type="text" size="25" name="forumicon" value="{F_ICON}" class="post" /></td>
</tr>

####### SAVE & CLOSE: templates\subSilver\admin\forum_edit_body.tpl #######
###################################################################### #####


#
#-----[ ACTION: ]------------------------------------------
# OPEN: templates\subSilver\admin\category_edit_body.tpl

[FIND]:
   <tr>
     <td class="row1">{L_CATEGORY}</td>
     <td class="row2"><input type="text" size="25" name="cat_title" value="{CAT_TITLE}" /></td>
   </tr>

[ADD AFTER]:
<tr>
   <td class="row1">{L_ICON}</td>
   <td class="row2"><input type="text" size="25" name="cat_icon" value="{CAT_ICON}" class="post" /></td>
</tr>


####### SAVE & CLOSE: templates\subSilver\admin\category_edit_body.tpl #######
###################################################################### ########


#
#-----[ ACTION: ]------------------------------------------
# OPEN: templates\subSilver\index_body.tpl

[FIND]:
<span class="cattitle"><a href="{catrow.U_VIEWCAT}" class="cattitle">{catrow.CAT_DESC}</a></span>

[ADD BEFORE]:
{catrow.CAT_ICON}


------------------------------
[FIND]:
<span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a>

[ADD BEFORE]:
{catrow.forumrow.FORUM_ICON}


####### SAVE & CLOSE: templates\subSilver\index_body.tpl #######
################################################################






So, I asked her if she ran the SQL and she says that from what she can remember she did/ I looked up her database and it does show the added forum_icon in the phpbb_forums table.

So i'm not really sure what to check next.  Embarassed
Back to Top
View user's profile Find all posts by FTM Send private message   Visit poster's website Yahoo Messenger
Re: Error I can't troubleshoot
PostPosted: 07/07/2007 11:21 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:29 PM
Location: St Pete, FL
peace.gif
I really don't see anything wrong with the query that's failing.  The only thing that I can think of that might cause this to fail is if you are attempting to insert a record with a forum_id duplicate with an existing record.  You could also check the phpbb_forums table to make sure that the forum_id field is not set to autoincrement.  That might be able to cause a failure like this as well since the query is attempting to add a static forum_id value...

dontknow
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Error I can't troubleshoot
PostPosted: 07/08/2007 9:00 AM Reply with quote
Caravan
FTM
Caravan
Posts 282
Word Cnt. 31,380
BDay Apr 14
Sign Aries
Sex Sex:Female
Joined: Nov 01, 2006
Local time: 10:29 PM
Location: Denver, PA
usaCa.gif
Ok, I pulled up the database, and am looking at the forum_id field, but I don't know how to tell if it's set to autoincrement or not. Here is a screen shot, if that helps.



Also, while I was there I tried to make a new category to see if it would work, and I got a different error.

Code:

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 ('test', 50, )

Line : 515
File : admin_forums.php


Code:

$sql = "INSERT INTO " . CATEGORIES_TABLE . " (cat_title, cat_order, cat_icon)
            VALUES ('" . $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);
         }
Back to Top
View user's profile Find all posts by FTM Send private message   Visit poster's website Yahoo Messenger
Re: Error I can't troubleshoot
PostPosted: 07/14/2007 4:26 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:29 PM
Location: St Pete, FL
peace.gif
To see the structure of the field, click on the little pencil to the far right of the forum_id field:



If it is set to Auto Increment, then you would see this in the Extra field in phpMyAdmin:



In MySql-Front, you would select the table on the left, then right-click and choose Properties:



Then on the Fields tab, you could double-click on the forum_id field:



The Auto Increment option would be selected if the field automatically increments...



munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Error I can't troubleshoot
PostPosted: 07/14/2007 4:30 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:29 PM
Location: St Pete, FL
peace.gif
Which forum is this happening on?  I just successfully created a new forum at the Flocking Together forum.  Did you find a fix for this or is it happening in a different forum???

dontknow
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
Re: Error I can't troubleshoot
PostPosted: 07/16/2007 8:51 AM Reply with quote
Caravan
FTM
Caravan
Posts 282
Word Cnt. 31,380
BDay Apr 14
Sign Aries
Sex Sex:Female
Joined: Nov 01, 2006
Local time: 10:29 PM
Location: Denver, PA
usaCa.gif
Hi Nightrider! Thanks for getting back to me. This is happening on a forum that hosts through me, so it's not on my forums. The forum with this problem is www.showpugs.com

I have checked the forum_id and it is not set to auto_increment, the extra field is blank. Any other idea's? Do you need to look at it yourself?
Back to Top
View user's profile Find all posts by FTM Send private message   Visit poster's website Yahoo Messenger
Re: Error I can't troubleshoot
PostPosted: 07/16/2007 5:08 PM Reply with quote
Site Admin
Nightrider
Site Admin
Posts 30757
Word Cnt. 2,628,690
BDay Jul 28
Sign Leo
Sex Sex:Male
Joined: Sep 25, 2004
Local time: 10:29 PM
Location: St Pete, FL
peace.gif
It might be easier to track down and correct the problem if I can take a closer look at it.  This is definitely a weird problem...

munky2
Back to Top
View all pictures posted by this userView user's profile Find all posts by Nightrider Send private message   AIM Address Yahoo Messenger Phoogle Map ICQ Number
 Post new topic  Reply to topic
Information
Welcome to RCF - WHF Forum Index -> Area 51 - phpBB & Easymod Tech Support

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum
All times are GMT - 5 Hours

Page 1 of 1


Add To Bookmarks

 
  
  


  Google

Powered by phpBB © 2001, 2005 phpBB Group

Page generation time: 0.1025s (PHP: 74% - SQL: 26%) - SQL queries: 49 - GZIP disabled - Debug on