This is failing:
INSERT INTO sportman
(image)
VALUES
('/res/(1)(38).jpg')
WHERE sportman_code = '1';开发者_JAVA百科
image
is text and sportman_code
is char(20).
You do not need WHERE
clause with INSERT
query remove that part
insert into sportman(image) values('/res/(1)(38).jpg')
if you are looking to update record use update query instead
UPDATE sportman
SET image='/res/(1)(38).jpg'
WHERE sportman_code = '1';
I think you are looking for UPDATE instead
UPDATE sportman
SET `image`='/res/(1)(38).jpg'
WHERE sportman_code = '1';
This query is failing because there's not supposed to be a WHERE
clause on an INSERT
statement.
update sportman set image= '/res/(1)(38).jpg' where sportman_code = '1';
you need a update query not insert query, if you are updating existing record.
Or
to insert new record
INSERT INTO sportman (image,sportman_code)
VALUES ('/res/(1)(38).jpg', '1');
Insert doesn't have a WHERE syntax.
Try this one:
INSERT INTO sportman
(image,
sportman_code)
VALUES ('/res/(1)(38).jpg',
'1');
Or do with an UPDATE query
UPDATE sportman
SET image = '/res/(1)(38).jpg'
WHERE sportman_code = '1';
精彩评论