I have done the Setup database in localhost PHPMyadmin.
when I submit a form via PHP it throw error like please enter valid length
What is the problem with this query?
Please look into the query and help.
CREATE TABLE `test`.`test`
(
`id` INT NOT NULL auto_increment,
`oname` VARCHAR(50) NOT NULL,
`cname` VARCHAR NOT NULL,
`cphone` VARCHAR NOT NULL,
`cemail` VARCHAR NOT NULL,
`tplot` VARCHAR NOT NULL,
`registerno` VARCHAR NOT NULL,
`registerdoc` TEXT NOT NULL,
`tpscheme` INT NOT NULL,
`tpnumber` INT NOT NULL,
`spnumber` INT NOT NULL,
`area` VARCHAR NOT NULL,
`plotarea` INT NOT NULL,
`direction` VARCHAR NOT NULL,
`roads` VARCHAR NOT NULL,
`r1w` VARCHAR NOT NULL,
`r2w` VARCHAR NOT NULL,
`r3w` VARCHAR NOT NULL,
`r4w` VARCHAR NOT NULL,
`r1d` VARCHAR NOT NULL,
`r2d` VARCHAR NOT NULL,
`r3d` VARCHAR NOT NULL,
`r4d` VARCHAR NOT NULL,
`zoning` INT NOT NULL,
`zoningdoc` INT NOT NULL,
`benefit` VARCHAR NOT NULL,
`natureplot` VARCHAR NOT NULL,
`deduction` VARCHAR NOT NULL,
`howmuch` INT NOT NULL,
`allsidedoc` VARCHAR NOT NULL,
`diagonaldoc` VARCHAR NOT NULL,
`totalmem` INT NOT NULL,
`flatgiven` INT NOT NULL,
`fun` VARCHAR NOT NULL,
`fun` VARCHAR NOT NULL,
PRIMARY KEY (`id`)
)
engine = innodb;
2
Answers
The max length of a VARCHAR is not dynamic, it is fixed and therefore has to be specified.
http://sqlines.com/mysql/datatypes/varchar
You must assign a length to varchar datatype eg: VARCHAR(255)