Click here to Skip to main content
15,389,918 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
need to find this error

cant find it please help

What I have tried:

PHP
CREATE TABLE tbl_images
(
    img_id int (100) NOT NULL AUTO_INCREMENT,
    name varchar (100) NOT NULL,
    image longblob (100) NOT NULL,
    size int (15) NOT NULL,
    type varchar (12) NOT NULL,
    PRIMARY KEY (img_id)
    
);
Posted
Updated 30-May-18 13:23pm

Try

CREATE TABLE tbl_images
(
    img_id int (11) NOT NULL AUTO_INCREMENT,
    name varchar (100) NOT NULL,
    image longblob (100) NOT NULL,
    size int (15) NOT NULL,
    type varchar (12) NOT NULL,
    PRIMARY KEY (img_id)
    
);


See MySQL :: MySQL 5.5 Reference Manual :: 11.2.1 Integer Types (Exact Value) - INTEGER, INT, SMALLINT, TINYINT, MEDIUMINT, BIGINT[^]

Int maximun size is 11 (consisting of 10 numbers + negative sign)
   
You're specifying a field size for your integer columns and the longblob column. You can't do that.

I don't do MySQL but I think the CREATE TABLE statement should be something like:
    CREATE TABLE tbl_images
(
    img_id int NOT NULL AUTO_INCREMENT,
    name varchar (100) NOT NULL,
    image longblob NOT NULL,
    size int NOT NULL,
    type varchar(12) NOT NULL,
    PRIMARY KEY (img_id)
};
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900