⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

Problem with adding a record



jgalak
  • profile picture
  • Member

Posted 01 March 2013 - 00:47 AM

So, I got a new problem that developed.  I can't seem to add.  When I click add, I get the add window.  When I click "save" or  "save and go back to list", I get the "Loading, Saving data" message, but nothing happens.  No record gets added, and the "save and go back to list" button doesn't take me back to the list.

 

For reference, the edit functionality works perfectly.

 

Any thoughts?

 

Code for the controller and view is posted here: /topic/1411-route-problem/ and here: /topic/1410-pages-of-rows-on-the-grid-view/

 

 

Thanks,

Juliean.


victor
  • profile picture
  • Member

Posted 01 March 2013 - 10:19 AM

what error do you get from the debug panel?
show your routing too.

jgalak
  • profile picture
  • Member

Posted 01 March 2013 - 19:11 PM

The routing is in the link above (just the one line: $route['default_controller'] = "roll_c";  )

 

And now to demonstrate my complete novice status - which debug panel?  I don't really know javascript/jquery/etc., but when I bring up FireFox's Debugger, and tell it to pause on exception, I get a DOMException with a whole lot of info.  I can't seem to be able to cut and paste the whole exception, so I'm not sure which info you need.  In the function scope tree, under the exception, there's a "_proto_: [object XPC_WN_ModsAllowed_NoCall_Proto_JSClass]" and then a whole lot of data items and subtrees (ABORT_ERR: 20, DATA_CLONE_ERR:25, etc...)

 

I've temporarily enable "add" without needing to log in, so you can see the application here: http://www.jgalak.com/heraldry/rolls/index.php/roll_c/rolls


victor
  • profile picture
  • Member

Posted 02 March 2013 - 09:45 AM

A Database Error Occurred
Error Number: 1062
Duplicate entry '0' for key 'PRIMARY' INSERT INTO `Rolls` (`Roll_Name`, `Link`, `Description`, `ArtworkStyleID`, `DateStart`, `DateEnd`, `Country`) VALUES ('test', 'test', NULL, NULL, NULL, NULL, NULL)
Filename: /home/jgalak/public_html/heraldry/rolls/models/grocery_crud_model.php
Line Number: 481

jgalak
  • profile picture
  • Member

Posted 03 March 2013 - 17:34 PM

Thank you, that was the clue I needed.  The primary key wasn't set to autoincrement in the database.


victor
  • profile picture
  • Member

Posted 03 March 2013 - 17:39 PM

Read articles how to debug code. It's will be very useful for you )


jgalak
  • profile picture
  • Member

Posted 03 March 2013 - 19:51 PM

Any particular articles?  I didn't see any such on this site.  Or do you mean in general on debugging PHP?

 

Also, is there any way to display the db error message in g-crud?  I have another field that needs to be unique (link), and if a user adds a redundant record, I would like a meaningful error message, not just a failed add.

 

Thanks,

Juliean.


davidoster
  • profile picture
  • Member

Posted 04 March 2013 - 10:14 AM

CodeIgniter has a profiler setting that you can enable in order to show you some information.

This is a good starting point, http://ellislab.com/codeigniter/user-guide/general/profiling.html

 

Other than that check also firebug for firefox or similar for the other browsers.