Reputation: 21
Error:
> #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use
> near 'where `membership_num`='1'' at line 1
Query:
UPDATE `MEMBERSHIP`
SET `member_id`= 2,
`sales_id`=1,
`duration`='3 شهور',
`start_date`='2016-10-16',
`end_date`='2016-10-16',
`membership_cost_before`=500,
`discount`=0,
`member_ship_cost` =500,
`membership_type` ='Silver',
`amout_done` =500,
`amount_reminder` = 0,
`trainer_id` =
WHERE `membership_num`=1
Upvotes: 1
Views: 51
Reputation: 2179
You forget to put value for trainer_id=
so Put any value for trainer_id before where condition, Here I'm putting Null value trainer_id=Null
Try this Query
UPDATE `MEMBERSHIP`
SET `member_id`= 2,
`sales_id`=1,
`duration`='3 شهور',
`start_date`='2016-10-16',
`end_date`='2016-10-16',
`membership_cost_before`=500,
`discount`=0,
`member_ship_cost` =500,
`membership_type` ='Silver',
`amout_done` =500,
`amount_reminder` = 0,
`trainer_id` =NULL
WHERE `membership_num`=1
Note: Make sure trainer_id
column should be set not null false in database structure if you want to update null value for that.
Upvotes: 1
Reputation: 20496
trainer_id = where membership_num=1
You have to specify what trainer_id is. Right now you just have an = sign with nothing after so that is the syntax error.
Upvotes: 1