1

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
2
  • Put any value for trainer_id = ? before where condition Commented Jul 16, 2016 at 5:38
  • 1
    Thank You for answer it working (Y) Commented Jul 16, 2016 at 6:17

2 Answers 2

1
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.

Sign up to request clarification or add additional context in comments.

2 Comments

trainer_id=NULL WHERE membership_num=1
@AhmedAlaaEldeen No problem! Glad I could help!! :)
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.