• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.5 MediaGallery problem(

#1
I create new catagort on mediagaller but give me this failed.

Code:
Server Error Log
Error Info
Zend_Db_Statement_Mysqli_Exception: Mysqli statement execute error : Field 'category_id' doesn't have a default value - library/Zend/Db/Statement/Mysqli.php:214
Generated By: SANCAKBEY, 2 minutes ago
Stack Trace
#0 /home/turkgame/public_html/library/Zend/Db/Statement.php(297): Zend_Db_Statement_Mysqli->_execute(Array)
#1 /home/turkgame/public_html/library/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /home/turkgame/public_html/library/Zend/Db/Adapter/Abstract.php(574): Zend_Db_Adapter_Abstract->query('INSERT INTO `xe...', Array)
#3 /home/turkgame/public_html/library/XenForo/DataWriter.php(1638): Zend_Db_Adapter_Abstract->insert('xengallery_cate...', Array)
#4 /home/turkgame/public_html/library/XenForo/DataWriter.php(1627): XenForo_DataWriter->_insert()
#5 /home/turkgame/public_html/library/XenForo/DataWriter.php(1419): XenForo_DataWriter->_save()
#6 /home/turkgame/public_html/library/XenGallery/ControllerAdmin/Media.php(270): XenForo_DataWriter->save()
#7 /home/turkgame/public_html/library/XenForo/FrontController.php(351): XenGallery_ControllerAdmin_Media->actionCategorySave()
#8 /home/turkgame/public_html/library/XenForo/FrontController.php(134): XenForo_FrontController->dispatch(Object(XenForo_RouteMatch))
#9 /home/turkgame/public_html/admin.php(13): XenForo_FrontController->run()
#10 {main}
Request State
array(3) {
  ["url"] => string(61) "http://adresinburasi.com/admin.php?xengallery/categories/save"
  ["_GET"] => array(1) {
    ["xengallery/categories/save"] => string(0) ""
  }
  ["_POST"] => array(14) {
    ["category_title"] => string(13) "# FORUM GENEL"
    ["category_description"] => string(0) ""
    ["parent_category_id"] => string(1) "0"
    ["display_order"] => string(1) "1"
    ["min_tags"] => string(1) "1"
    ["usable_media_type"] => string(3) "sel"
    ["media_type_checkboxes"] => array(1) {
      [0] => string(11) "video_embed"
    }
    ["user_group_type_view"] => string(3) "all"
    ["user_group_type_add"] => string(3) "sel"
    ["add_user_group_ids"] => array(5) {
      [0] => string(1) "4"
      [1] => string(1) "5"
      [2] => string(1) "2"
      [3] => string(1) "6"
      [4] => string(1) "3"
    }
    ["_xfToken"] => string(8) "********"
    ["_xfRequestUri"] => string(36) "/admin.php?xengallery/categories/add"
    ["_xfNoRedirect"] => string(1) "1"
    ["_xfResponseType"] => string(4) "json"
  }
}
Delete...Close
 
Last edited:

Jake Bunce

XenForo moderator
Staff member
#2
The error refers to xengallery_category.category_id which is an auto primary key. But the error about a "default value" indicates that this index is missing.

Did you perform any major database maintenance recently such as a backup/restore or server move? If the key was lost in such a process then you should really go back and revisit it since there may be other problems. You could recreate the index but the concern is that this might not be an isolated problem.
 

Jake Bunce

XenForo moderator
Staff member
#4
In that case try running these two queries to ensure the primary key and column def are correct:

Code:
ALTER TABLE xengallery_category ADD PRIMARY KEY (category_id);

ALTER TABLE xengallery_category CHANGE category_id category_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT;