Jump to content


Exception raise:

question

  • Please log in to reply
5 replies to this topic

#1 Paks

Paks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 January 2012 - 06:25 PM

I uploaded my backend with grocery CRUD to a temp server on the internet, and setup codeigniter config vars and routes, but then, when I try to insert or update a data a exception raise

Fatal error: Uncaught exception 'Exception' with message 'On the state "insert" you must have post data' in /web/htdocs/xxx/home/demo/criteris/application/libraries/grocery_crud.php:1967
Stack trace:
#0 /web/htdocs/xxx/home/demo/criteris/application/libraries/grocery_crud.php(2679): grocery_States->getStateInfo()
#1 /web/htdocs/xxx/home/demo/criteris/application/controllers/admin.php(119): grocery_CRUD->render()
#2 [internal function]: Admin->glosari('insert')
#3 /web/htdocs/xxx/home/demo/criteris/system/core/CodeIgniter.php(359): call_user_func_array(Array, Array)
#4 /web/htdocs/xxx/home/demo/criteris/index.php(202): require_once('/web/htdocs/www...')
#5 {main}
  thrown in /web/htdocs/xxx/home/demo/criteris/application/libraries/grocery_crud.php on line 1967

I have check everything i can think off, global_xss_filtering is set to false

this is the form generated by Grocery

<form action='http://xxx/demo/criteris/admin/glosari/insert' method='post' id='crudForm' autocomplete='off' enctype="multipart/form-data">

this is the controller function
public function glosari()
   {
	  $this->grocery_crud->set_table('cri_glosari');
	  $output = $this->grocery_crud->render();
	  $this->layout_library->set_title('Glosari');
	  $this->layout_library->add_menu($this->menu_list,'Glosari');
	  $this->layout_library->view('cms_crud_view', $output, 'cms_crud_layout');
   }

I'm kind of ashamed because in my local apache server works like a charm...

Any clue on what I can be missing is more than welcome...
thanks in advance.

#2 Paks

Paks

    Newbie

  • Members
  • Pip
  • 5 posts

Posted 24 January 2012 - 06:41 PM

I just have to post to see what was i doing wrong... and by that i'm sorry... hope this will be used anytime by someone as %"·$&%"· as i am...

The error was as common as it can gets, and of course, have nothing to do with groceryCRUD

I was missing the full path in $config['base_url']...

Sorry for any inconvenience i have done... and once again, thank you so much for share your talent with this excelente peace of code

#3 Adamantus

Adamantus

    Member

  • Members
  • PipPip
  • 19 posts

Posted 18 May 2012 - 10:38 AM

Hi. I'm having this issue as well but it's not related to the config file. It only happens when I try to add / edit my users table. I get the following errors in the error_log:

  [18-May-2012 11:14:59] PHP Fatal error:  Uncaught exception 'Exception' with message 'On the state "update" you must have post data' in /home/.../public_html/.../application/libraries/grocery_crud.php:2476
Stack trace:
#0 /home/.../public_html/.../application/libraries/grocery_crud.php(3324): grocery_CRUD_States->getStateInfo()
#1 /home/.../public_html/...application/controllers/groceries.php(118): grocery_CRUD->render()
#2 [internal function]: Groceries->users('update', '1')
#3 /home/.../public_html/...system/core/CodeIgniter.php(359): call_user_func_array(Array, Array)
#4 /home/.../public_html/...index.php(202): require_once('/home/......')
#5 {main}
  thrown in /home/.../public_html/.../application/libraries/grocery_crud.php on line 2476


My controller looks as follows:

function users()
	{	
	  $output = $this->grocery_crud->render();//Set output variable for view.

	  $this->_example_output($output);
	}

That isn't the code I want to run but it's the simplist example I could do to demonstrate the problem. All other tables work fine but not users. I can even display users fine but not add / edit. BTW the screen hangs and does not load up, no errors on screen.

EDITED
I should have mentioned some of the things I've tried so far:
  • Looking through error report
  • Checking CI log file, nothing of interest.
  • Changing table name
  • Deleting all table columns except one
  • Changing primary key of only row inside users table
  • Reducing example to two simple lines which should just work
  • Moving method to top of class to see if there is a conflict
  • Checking related classes to see if there is a conflict there, the others seem to work
  • Checked known Grocery CRUD issues page, nothing I'm doing that shouldn't be
  • Altered content type and colllations of table to utf8 and collation = general_ci


#4 web-johnny

web-johnny

    grocery CRUD Author

  • Administrators
  • 1,150 posts
  • LocationLondon

Posted 18 May 2012 - 09:42 PM

As you describe your problem "It only happens when I try to add / edit my users table", so it has to be something simple. The only thing that you didn't do at the list is to change the function name. I don't know why but I believe there is something to with your function. So if you just try:
function users_management()
{	  
	   $this->grocery_crud->set_table('users');
	    $output = $this->grocery_crud->render();//Set output variable for view.
	    $this->_example_output($output);
}

I think it will work.
Posted Image

#5 Adamantus

Adamantus

    Member

  • Members
  • PipPip
  • 19 posts

Posted 21 May 2012 - 11:04 AM

I tried changing the name of the method and hardcoding the table name but there was no change and it still hanged. Could this be htaccess issue? I'm struggling now:

RewriteEngine on
RewriteBase /
RewriteCond $1 !^(index\.php|images|general|javascript|robots\.txt|js|css|assets|phpinfo\.php)
RewriteRule ^(.*)$ index.php?/$1 [L]

Notice that I added assets. My site is in this format: test.mydomain.co.uk

EDITED:
Ok I tried it again and for some reason this time everything is ok. I tried several edits and it's all working.

#6 Sanaa Alauddin Khan

Sanaa Alauddin Khan

    Member

  • Members
  • PipPip
  • 22 posts

Posted 23 July 2015 - 04:39 AM

adding my base url worked for me. thanks alot. i spent hours thinking it was a bug in grocery crud!







Also tagged with one or more of these keywords: question

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users