Requested JSON parse failed on Table with Foreign Key "not n

Requested JSON parse failed on Table with Foreign Key "not n

Postby Biertrinker » Sun Jul 24, 2016 4:24 pm

hello

i cant insert Data in a Table if the Foreign Key is set to "not null"

the Database structure:

CREATE TABLE `orte` (
`id_orte` int(11) NOT NULL AUTO_INCREMENT,
`ortsname` varchar(50) NOT NULL,
`plz` int(5) DEFAULT '0',
`info` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id_orte`)

CREATE TABLE `personen` (
`id_personen` int(11) NOT NULL AUTO_INCREMENT,
`vorname` varchar(50) DEFAULT NULL,
`nachname` varchar(50) NOT NULL,
`info` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id_personen`)


CREATE TABLE `buchungen` (
`id_buchungen` int(11) NOT NULL AUTO_INCREMENT,
`fk_orte` int(11) NOT NULL,
`fk_personen` int(11) NOT NULL,

`info` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id_buchungen`),
KEY `fk_buchungen_1` (`fk_orte`),
KEY `fk_buchungen_2` (`fk_personen`),
CONSTRAINT `fk_buchungen_1` FOREIGN KEY (`fk_orte`) REFERENCES `orte` (`id_orte`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_buchungen_2` FOREIGN KEY (`fk_personen`) REFERENCES `personen` (`id_personen`) ON DELETE CASCADE ON UPDATE CASCADE
)



Is it set to "DEFAULT NULL" then i can insert Data


CREATE TABLE `buchungen` (
`id_buchungen` int(11) NOT NULL AUTO_INCREMENT,
`fk_orte` int(11) ,
`fk_personen` int(11) ,

`info` varchar(100) DEFAULT NULL,
PRIMARY KEY (`id_buchungen`),
KEY `fk_buchungen_1` (`fk_orte`),
KEY `fk_buchungen_2` (`fk_personen`),
CONSTRAINT `fk_buchungen_1` FOREIGN KEY (`fk_orte`) REFERENCES `orte` (`id_orte`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `fk_buchungen_2` FOREIGN KEY (`fk_personen`) REFERENCES `personen` (`id_personen`) ON DELETE CASCADE ON UPDATE CASCADE
)


i see in the NuBuilder the field "Stop Blanks" but i need the check in the MySQL Database

is there a way ?

thanks
Biertrinker
Biertrinker
 
Posts: 6
Joined: Wed Jun 29, 2016 4:23 pm

Re: Requested JSON parse failed on Table with Foreign Key "n

Postby admin » Thu Jul 28, 2016 3:04 pm

Biertrinker,

nuBuilder can do all the checking you like using PHP before saving anything..

beforesave.PNG
beforesave.PNG (24.22 KiB) Viewed 2195 times


eg.

Code: Select all

   if('#sre_zzzsys_sql#' == '' and '#sre_zzzsys_php_id#' == ''){

  $MESS = "SQL or PHP is required to create a Report..";
  nuDisplayError($MESS);

}





Steven
admin
Site Admin
 
Posts: 3211
Joined: Mon Jun 15, 2009 9:53 am


Return to General