Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

New formular Field in Forum - need help with save data in DB

Asked Modified Viewed 1,132 times
C
Catzenjaeger
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions
asked
Senior Member

i want a formular field in my Forum so i have add this in administration/forums.php and add a row in my database sound "preferred"
see attached picture

i have add the field in my code and it works perfect (see image) .. but what not work is the the data save in my DB.
I get no errors ... but my DB Flied "preferred" is always empty and i know not why.
Here my modificied part where the script write data in DB (i hope thats all parts what i have to change)

what i change (makred with red)
1.) ...... (forum_cat, forum_name, preferred, forum_order, forum_description, forum_moderators,......
2.) ...VALUES ('0', '$cat_name', '','$cat_order', '', '', '0', '0', '0', '0', '0', '0', '0', '0')"); ...

and near end of this code

1.) ....(forum_cat, forum_name, preferred, forum_order, forum_description, forum_moderators, ...
2.) ....VALUES ('".$forum_cat."', '".$forum_name."', '0','".$forum_order."', '".$forum_description."', '103', '101', '101', '101', '0', '0', '0', '0', '0', '0', '0')");...

in attchament y pic of my database and the complete administration/forums.php

if (isset($_POST['save_cat'])) {
   $cat_name = trim(stripinput($_POST['cat_name']));
   if ($cat_name != "") {
      if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['forum_id']) && isnum($_GET['forum_id'])) && (isset($_GET['t']) && $_GET['t'] == "cat")) {
         $result = dbquery("UPDATE ".DB_FORUMS." SET forum_name='$cat_name' WHERE forum_id='".$_GET['forum_id']."'");
         redirect(FUSION_SELF.$aidlink."&status=savecu");
      } else {
         $cat_order = isnum($_POST['cat_order']) ? $_POST['cat_order'] : "";
         if(!$cat_order) $cat_order=dbresult(dbquery("SELECT MAX(forum_order) FROM ".DB_FORUMS." WHERE forum_cat='0'"),0)+1;
         $result = dbquery("UPDATE ".DB_FORUMS." SET forum_order=forum_order+1 WHERE forum_cat='0' AND forum_order>='$cat_order'");
         $result = dbquery("INSERT INTO ".DB_FORUMS." (forum_cat, forum_name, preferred, forum_order, forum_description, forum_moderators, forum_access, forum_post, forum_reply, forum_poll, forum_vote, forum_attach, forum_lastpost, forum_lastuser) VALUES ('0', '$cat_name', '','$cat_order', '', '', '0', '0', '0', '0', '0', '0', '0', '0')");
         redirect(FUSION_SELF.$aidlink."&status=savecn");
      }
   } else {
      redirect(FUSION_SELF.$aidlink."&status=savect");
   }
} elseif (isset($_POST['save_forum'])) {
   $forum_name = trim(stripinput($_POST['forum_name']));
   $forum_description = trim(stripinput($_POST['forum_description']));
   $forum_cat = isnum($_POST['forum_cat']) ? $_POST['forum_cat'] : 0;
   if ($forum_name != "") {
      if ((isset($_GET['action']) && $_GET['action'] == "edit") && (isset($_GET['forum_id']) && isnum($_GET['forum_id'])) && (isset($_GET['t']) && $_GET['t'] == "forum")) {
         $forum_mods = $_POST['forum_mods'];
         $forum_access = isnum($_POST['forum_access']) ? $_POST['forum_access'] : 0;
         $forum_post = isnum($_POST['forum_post']) ? $_POST['forum_post'] : 0;
         $forum_reply = isnum($_POST['forum_reply']) ? $_POST['forum_reply'] : 0;
         $forum_attach = isnum($_POST['forum_attach']) ? $_POST['forum_attach'] : 0;
         $forum_attach_download = isnum($_POST['forum_attach_download']) ? $_POST['forum_attach_download'] : 0;
         $forum_poll = isnum($_POST['forum_poll']) ? $_POST['forum_poll'] : 0;
         $forum_vote = isnum($_POST['forum_vote']) ? $_POST['forum_vote'] : 0;
         $forum_merge = (isset($_POST['forum_merge']) && isnum($_POST['forum_merge']) ? $_POST['forum_merge'] : 0);
         $result = dbquery("UPDATE ".DB_FORUMS." SET forum_name='".$forum_name."', forum_cat='".$forum_cat."', forum_description='".$forum_description."', forum_moderators='".$forum_mods."', forum_access='".$forum_access."', forum_post='".$forum_post."', forum_reply='".$forum_reply."', forum_attach='".$forum_attach."', forum_attach_download='".$forum_attach_download."', forum_poll='".$forum_poll."', forum_vote='".$forum_vote."', forum_merge='".$forum_merge."' WHERE forum_id='".$_GET['forum_id']."'");
         redirect(FUSION_SELF.$aidlink."&status=savefu");
      } else {
         $uniqueCheck = dbcount("(forum_id)", DB_FORUMS, "forum_cat='".$forum_cat."' AND forum_name='".$forum_name."'");
         if ($uniqueCheck != 0) { redirect(FUSION_SELF.$aidlink."&status=saveft"); }
         $forum_order = isnum($_POST['forum_order']) ? $_POST['forum_order'] : "";
         if(!$forum_order) $forum_order=dbresult(dbquery("SELECT MAX(forum_order) FROM ".DB_FORUMS." WHERE forum_cat='$forum_cat'"),0)+1;
         $result = dbquery("UPDATE ".DB_FORUMS." SET forum_order=forum_order+1 WHERE forum_cat='$forum_cat' AND forum_order>='$forum_order'");
         $result = dbquery("INSERT INTO ".DB_FORUMS." (forum_cat, forum_name, preferred, forum_order, forum_description, forum_moderators, forum_access, forum_post, forum_reply, forum_attach, forum_attach_download, forum_poll, forum_vote, forum_lastpost, forum_lastuser, forum_merge) VALUES ('".$forum_cat."', '".$forum_name."', '0','".$forum_order."', '".$forum_description."', '103', '101', '101', '101', '0', '0', '0', '0', '0', '0', '0')");
         redirect(FUSION_SELF.$aidlink."&status=savefn");


Merged on Oct 20 2015 at 14:59:46:
none can help? i have atm no idea whats wrong but it dosent work :(
Edited by Catzenjaeger on 20-10-2015 13:59,
Catzenjaeger attached the following file:
forums.zip [No information available / 143 Downloads]
2_5.jpg [No information available / 59 Downloads]
1_8.jpg [No information available / 57 Downloads]
0 replies
There are no post found.

Labels

None yet

Statistics

  • Views 0 views
  • Posts 0 posts
  • Votes 0 votes
  • Topic users 1 member

1 participant

C
C
  • Senior Member, joined since
  • Contributed 408 posts on the community forums.
  • Started 137 threads in the forums
  • Started this discussions

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet