开发者

user insert into course as shown I want the course_limit to increment by 1 for that user

开发者 https://www.devze.com 2023-02-20 21:45 出处:网络
Let\'s say I have two tables as shown: user idplancourse_limitusername 100ahmad note: plan is enum field containing \'\',\'a\',\'b\',\'c\'.

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'
0

精彩评论

暂无评论...
验证码 换一张
取 消