Thursday 15 January 2015

mysql - insert into table if user has permission -



mysql - insert into table if user has permission -

i insert record if user has permission so.

i'm looking like

insert `restaurants` ('id1','id2','id3') values(1,2,3) left bring together 'permissions p' on (`p`.`re_id`=`restaurants`.`id`) `p`.`user_id`='123' , `p`.`perm`=3

the way @ moment first run query against 'permissions' table , if user , permissions match perform insert in sec query.

i wonder if there way utilize 1 query. thanks

edit point out web app done php , session/cookies.

mysql

No comments:

Post a Comment