• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scaffolding and Foreign Key , please

#1
[eluser]Unknown[/eluser]
Hi men.

The first thing , I love Code Igniter Smile
In an application that I am doing, I'm using foreign keys (MySQL innoDB)

This possible library Scaffolding work a with Foreign keys ?
Why not work for me at the time of insertion and edit.

PD: C.I 1.6
PD: Sorry if something similar already been posted.

a "sample" db

Code:
CREATE TABLE `cliente` (
  `id_cliente` int(11) NOT NULL default '0',
  `nombre` varchar(30) default NULL,
  PRIMARY KEY  (`id_cliente`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

INSERT INTO `cliente` VALUES (1, 'pepe');

CREATE TABLE `venta` (
  `id_factura` int(11) NOT NULL default '0',
  `id_cliente` int(11) NOT NULL default '0',
  `cantidad` int(11) default NULL,
  PRIMARY KEY  (`id_factura`),
  KEY `id_cliente` (`id_cliente`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1;

ALTER TABLE `venta`
  ADD CONSTRAINT `venta_ibfk_1` FOREIGN KEY (`id_cliente`) REFERENCES `cliente` (`id_cliente`);

INSERT INTO `venta` VALUES (1, 1, 200);

Bye

#2
[eluser]Unknown[/eluser]
Please Helpme.

Let me know if I set the scalafolding for linking fields with tables
[Image: dudaci.png]


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.