Trying to create a 1:M cart : cart_items table structure:
CREATE TABLE IF NOT EXISTS `carts` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`token` CHAR(32) NOT NULL ,
`date_created` DATETIME NOT NULL ,
`date_modified` DATETIME NOT NULL ,
PRIMARY KEY (`id`) )
ENGINE = InnoDB;
CREATE TABLE `cart_items` (
`id` INT UNSIGNED NOT NULL AUTO_INCREMENT ,
`cart_id` INT UNSIGNED NOT NULL ,
`date_added` DATETIME NOT NULL ,
`code` CHAR(19) NOT NULL ,
`qty` MEDIUMINT UNSIGNED NOT NULL DEFAULT 0 ,
PRIMARY KEY (`id`) ,
INDEX `the_cart` (`cart_id` ASC) ,
CONSTRAINT `the_cart`
FOREIGN KEY (`cart_id` )
REFERENCES `carts` (`id` )
ON DELETE CASCADE
ON UPDATE CASCADE)
ENGINE = InnoDB;
This works, except that when I go to insert a row into cart_items in PhpMyAdmin the interface is weird. Instead of the cart_id field being a normal text box to enter an id the field is a select box (see this screenshot)
The parent table has sample rows with ids of 25 and 31.
Is this a PhpMyAdmin bug?
Using MySQL 5.1.41 community on Windows. The same thing happens on the live server (5.0.91-community on Linux)