user insert into course as shown I want the course_limit to increment by 1 for that user
Let's say I have two tables as shown:
user
id plan course_limit username
10 0 ahmad
note: plan is enum field containing '','a','b','c'.
course
id user_id use开发者_StackOverflow中文版rname
1 10 ahmad
Now I want when a user insert into course as shown I want the course_limit to increment by 1 for that user so that I can apply a limit.
now i don,t want to use triggers as my hosting does not support so i want to use php and do this. plz help me.
You could run an UPDATE
statement after you run the INSERT
.
(If you are using MySQL) Ex:
UPDATE user SET course_limit=course_limit+1 WHERE username = '$username'
精彩评论