I got this error msg in my sql command. i am unable to figure out the cause. please help me.
if ( SELECT * FROM `teams` WHERE `client_id`='3' and `member_id`='6' and `current`='1' ) then
begin
UPDATE `teams` SET `current`='0' WHERE `client_id`='3' and `member_id`='6' and `current`='1'
end ;
else
begin
INSERT INTO `teams`(`client_id`, `member_id`) VALUES ('3','33')
end;
end if;
here i'm trying to update column current
if set to 1
, else insert a new record.
I need to use this sql command in my php file when a form is submitted.
below is the error message:
#1064 - You have an error in your SQL syntax;