mattevans Posted May 10, 2007 Share Posted May 10, 2007 Hi All. I have a little database of students Im currently working with. When a certain user logs in, they are shown certain details depending on what school they belong to. Im trying to SELECT all information from tbl_students WHERE the schoolID equals the school they belong to, but also the roomID (the room which they have selected). This way it will show me the students in a certain room, in a certain school. Im currently using the below code which doesnt work properly... $query = 'SELECT * FROM tbl_students WHERE schoolID ='.$_SESSION['schoolID'].' AND roomID ='.$roomID; Could someone please help me with this. It would be much appreciated. I have spent hours trying to work this thing out! :-X Thanks in Advance. Matt Evans Quote Link to comment https://forums.phpfreaks.com/topic/50850-mysql-select-help-please/ Share on other sites More sharing options...
Wildbug Posted May 10, 2007 Share Posted May 10, 2007 How does it "not work properly?" What results are you getting, if any, and what results did you expect? What's your table definition? Have you checked for errors, and, if so, what were they? You haven't supplied enough information for a diagnosis. Prima facie, the query is syntactically correct. Quote Link to comment https://forums.phpfreaks.com/topic/50850-mysql-select-help-please/#findComment-250128 Share on other sites More sharing options...
cmgmyr Posted May 10, 2007 Share Posted May 10, 2007 did you try echoing the query to make sure the vaiables are coming through ok? Quote Link to comment https://forums.phpfreaks.com/topic/50850-mysql-select-help-please/#findComment-250131 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.