⚠ 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

Primary key not first column = no display in view and edit



ComputingFroggy
  • profile picture
  • Member

Posted 04 October 2015 - 15:23 PM

Hi,

 

Let's say you have a table like that :

CREATE TABLE IF NOT EXISTS `MY_TAB` (
 `the_dtm` datetime NOT NULL ,
 `nb` int(11) NOT NULL ,
 `the_id` int(11) NOT NULL,

 `my_comment` varchar(2048) default NULL,
  PRIMARY KEY  (`the_id`,`the_dtm`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;

 

Then using CroceryCrud, when viewing or editing a row, you will get an empty form ! !

 

Now if the table is created like this :

CREATE TABLE IF NOT EXISTS `MY_TAB` (
 `the_id` int(11) NOT NULL,

 `the_dtm` datetime NOT NULL ,
 `nb` int(11) NOT NULL ,
 `my_comment` varchar(2048) default NULL,
  PRIMARY KEY  (`the_id`,`the_dtm`),
) ENGINE=InnoDB DEFAULT CHARSET=utf8 ;

Then GroceryCrud will work ! ! !

(Notice the colum the_id is now first)

 

This is at least a limitation if not a bug ... and should be least well documented (if not corrected).

 

 

Cheers,

L@u