Kindly pardon me if i looks silly , I am newbie in PhP MySQL
Totally there are three tables
Student,Class,Parent
I am working on parent user now . As a parent i want to view some things as below
- My Students studying
- Their class
Student Table :
s_id s_name parent_id s_class_id
1 name1 40 20
Class Table :
c_id c_name
20 Ten
Parent Table :
p_id p_name
40 Parent1
My 1st task as mentioned above "1. My Students studying " i done successfully with the following query
"SELECT * FROM student where parent_id='$update_id' "
then by displaying
$row['s_name']
For all who thinks where the $update id comes from , I already done it few codes above as follows
$update_id = $login_type['p_id'];
Where $login_type i am taking from session
Now i want to do my second task which is "2. Their class"
I don't want it to do as separate select query which i can do now, i want it to be in the same select above done . as i am just learning from scratch i am stuck over here . Kindly help me please mates.
I tried to explain the max as i can , if you still has any clarifications , kindly ask me .
SELECT s.*,c.c_name FROM student s INNER JOIN Class c ON(s.s_class_id = c.cid) where s.parent_id='$update_id'