php - MySQL query to grant access to a user by user name to another table -


user can access subject_table if valid user_name lies in user_profile, while both in same database , on valid credential outputs table contents of subjects_table.

this code :

get('/api/users/{user_name}',function(request $request,response $response){ $user_name=$request->getattribute('user_name'); $sql="select * subjects_table user_name='$user_name'  user_profile"; //user_name lies in table //how can join 2 tables  //user_name lies table named user_profile 

database structure:

table user_profile consists id, user_name, full_name, email_id, password 

database structure :

table subjects_table id, subject_name, web_url, image_url 

api

api/user/{user_name}
- gives contents of subject_table in json array


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -