Welcome to the nuBuilder forums!

Please register and login to view forums and other content only available to registered users.

Internal Server Error [500] with foreign key constraint

Post Reply
petern
Posts: 4
Joined: Wed Jul 09, 2014 6:41 pm

Internal Server Error [500] with foreign key constraint

Unread post by petern »

Hi,

First of all, compliments on what looks like an amazing and promising product. From what I have seen so far, it fills in an important gap for people (like me) to make the switch from MS Access to MySQL. Thank you also for releasing it under the GPL.

The problem I'm having right now is that even in the simplest setup of only one parent table (tableone) with a foreign key constraint to one child table (tabletwo), I get an Internal Server Error [500] when trying to save a new record in the parent. I'm sure the value I entered for the foreign key exists in the child. Adding similar records in the parent table using other applications is no problem. Only by removing the foreign key constraint, can I add a record using nuBuilderPro. See the attachment for more details.

I'm using MAMP 3.0.4 with Apache 2.2.26, MySQL 5.5.34 and PHP 5.4.26. See the attachments for more details.

This is what I tried already:
  • Different PHP versions (5.4.26 and 5.5.10).
  • Different nuBuilderPro versions (one downloaded from the website on June 4, 2014 and one downloaded from github today, July 9, 2014.
  • Reproduced under two different schemas.
  • Created forms manually and by the form wizard.
  • Set parameters in php.ini according to these requirements.
Attached are more details. Just let me know if more information is needed.

Thank you,
Peter
Attachments
petern 20140709 nuBuilderPro forum details.zip
A simple database that will lead to the error in my setup, the phpinfo() output, the nuBuilder installer output and a screenshot of the error.
(287.51 KiB) Downloaded 573 times
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Internal Server Error [500] with foreign key constraint

Unread post by admin »

petern,

You may have to remove the foreign key constraints

Steven
petern
Posts: 4
Joined: Wed Jul 09, 2014 6:41 pm

Re: Internal Server Error [500] with foreign key constraint

Unread post by petern »

You mean this is by design?
petern
Posts: 4
Joined: Wed Jul 09, 2014 6:41 pm

Re: Internal Server Error [500] with foreign key constraint

Unread post by petern »

Hi Steven,

As said in my original post, I did try to remove the foreign key constraint and then it works. However, I would really like to keep the constraint on.

Best regards,
Peter
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Internal Server Error [500] with foreign key constraint

Unread post by admin »

Peter,

At this time, foreign key constraints will not work with nuBuilder Pro, but you don't need foreign key constraints to have a one to many relationship in a database, you just need foreign keys.

Steven
petern
Posts: 4
Joined: Wed Jul 09, 2014 6:41 pm

Re: Internal Server Error [500] with foreign key constraint

Unread post by petern »

Ok, thanks for your explanation, hope support for this can be added soon!
admin
Site Admin
Posts: 2778
Joined: Mon Jun 15, 2009 2:23 am
nuBuilder Version: 4.5

Re: Internal Server Error [500] with foreign key constraint

Unread post by admin »

.
jens
Posts: 7
Joined: Fri Apr 14, 2017 11:34 am

Re: Internal Server Error [500] with foreign key constraint

Unread post by jens »

Hi,
admin wrote: At this time, foreign key constraints will not work with nuBuilder Pro, but you don't need foreign key constraints to have a one to many relationship in a database, you just need foreign keys.
I've hit the same problem. That is, designed my MySQL schema with foreign keys for the sake of referential integrity. But then I hit this 500 Server Error too.

As far as I learnt, I could still have some kind of data integrity by using a Dropdown referencing values (external foreign keys from another table). So this way the users would still only be a able to insert existing values. And this way there would also be some kind of referential integrity, but not done on the MySQL DB level, but at the application level by nuBuilderPro. Is this right?

I'm asking because I do not understand what should be the difference between foreign key constraints and foreign keys as given in the above answer. I'm not a MySQL expert, but googling for these terms suggests that foreign keys are always constraints in MySQL, see http://stackoverflow.com/questions/3105 ... difference or http://stackoverflow.com/questions/1265 ... oreign-key. So I am having problems to understand what I should practically do with the suggestion `you just need foreign keys`.

Kind regards,
Jens
Post Reply