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

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -