Forums
This topic is locked
php mysql multiple selects
Posted 31 Dec 2004 20:32:09
1
has voted
31 Dec 2004 20:32:09 Mia kimbhoot posted:
Hi,here is my scenario.. I'm working on this app.. and the problem arised when I was dealing with 3 tables.. I have a student table, a projects table and I added an intermediate table to join student and projects named studentprojects which has studentid and projectid. what I'm trying to do is, assign/de-assign projects to students. I'm passing the studentid from this page to the project assignment page there I'm selecting all records where studentid = url parameter. now I have all the projectid's now how do I select the rows from project table where it matches all the projectid's? I think I need to use a loop.. but not sure..
any help would be appreciated
Replies
Replied 01 Jan 2005 00:40:38
01 Jan 2005 00:40:38 Chris Charlton replied:
<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>...the problem arised when I was dealing with 3 tables.. I have a student table, a projects table and I added an intermediate table to join student and projects named studentprojects which has studentid and projectid. what I'm trying to do is, assign/de-assign projects to students. I'm passing the studentid from this page to the project assignment page there I'm selecting all records where studentid = url parameter. now I have all the projectid's now how do I select the rows from project table where it matches all the projectid's? I think I need to use a loop.. but not sure...<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>
I hope I'm following correctly, but it sounds like you just need another Recordset, grabbing the projects from your <i>projectID</i>.
I assume you are:
<i>1.)</i> have a page where they choose a student, then it...
<i>2.)</i> passes student ID to the assignment page, and it lists all projects for you to select multiple (form list/menu?) projects to...
<i>3.)</i> INSERT INTO studentprojects (table) multiple rows, correct? am I leaving anything out? (I'm tired today) <img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>
I hope I'm following correctly, but it sounds like you just need another Recordset, grabbing the projects from your <i>projectID</i>.
I assume you are:
<i>1.)</i> have a page where they choose a student, then it...
<i>2.)</i> passes student ID to the assignment page, and it lists all projects for you to select multiple (form list/menu?) projects to...
<i>3.)</i> INSERT INTO studentprojects (table) multiple rows, correct? am I leaving anything out? (I'm tired today) <img src=../images/dmxzone/forum/icon_smile_tongue.gif border=0 align=middle>
Replied 07 Jan 2005 16:48:27
07 Jan 2005 16:48:27 Mia kimbhoot replied:
Chris.. thanks for your reply.. I got it to work by modifying the sql statement.. had to use inner join..