I set up a table
CREATE TABLE Properties
(
id
SMALLINT UNSIGNED NOT NULL AUTO_INCREMENT,
memberid
SMALLINT UNSIGNED,
title
VARCHAR(50),
bldg
SMALLINT UNSIGNED,
unit
SMALLINT,
sqrfeet
SMALLINT,
pkng
CHAR(1),
type
CHAR(1),
saleprice
INT,
rentprice
INT,
startdate
DATE,
enddate
DATE,
desc
TEXT,
bath
FLOAT,
room
FLOAT,
image1
VARCHAR(255),
image2
VARCHAR(255),
image3
VARCHAR(255),
image4
VARCHAR(255),
image5
VARCHAR(255),
image6
VARCHAR(255),
display
CHAR(1),
datecreated
DATE NOT NULL,
PRIMARY KEY (id
),
FOREIGN KEY (memberid
) REFERENCES Members(id
)
);
which seems to be fine as I put it phpmyadmin, but when i try to insert a record using,
INSERT INTO Properties
(memberid
,title
,bldg
,unit
,sqrfeet
,pkng
,type
,saleprice
,rentprice
,startdate
,enddate
,desc
,bath
,room
,image1
,image2
,image3
,image4
,image5
,image6
,display
,datecreated
) VALUES (2,‘’,1710,305,2100,0,0,6,9,CURDATE(),CURDATE(),‘’,1,1,‘’,‘’,‘’,‘’,‘’,‘’,0,CURDATE())
It works… The only thing is that I try to make the saleprice, rentprice, startdate and enddate fields optional but I get an error when I try
INSERT INTO Properties
(memberid
,title
,bldg
,unit
,sqrfeet
,pkng
,type
,saleprice
,rentprice
,startdate
,enddate
,desc
,bath
,room
,image1
,image2
,image3
,image4
,image5
,image6
,display
,datecreated
) VALUES (2,‘’,1710,305,2100,0,0,‘’,1,1,‘’,‘’,‘’,‘’,‘’,‘’,0,CURDATE())
I get an error.
What is wrong?