dollythesheep Posted March 30, 2008 Share Posted March 30, 2008 I'm trying to query so that the answers of my first query becomes part of my second query and the answers to the second query becomes part of the third query...but it's not returning anything..any ideas? $qry = "SELECT * FROM detentiondates"; $result = mysql_query($qry); $result_array = mysql_fetch_assoc($result); $qry2 = "SELECT detentiondate FROM detention WHERE detentiondate='$result_array[result]' AND pupilno='$_SESSION[pupilno]'"; $result2 = mysql_query($qry2); $result_array2 = mysql_fetch_assoc($result2); $query3 = mysql_query("SELECT detentiondates.detentiondate FROM detentiondates, academicyear WHERE detentiondates.detentiondate != '$_SESSION[detentiondate]' AND detentiondates.detentiondate <= academicyear.enddate AND detentiondates.detentiondate >= academicyear.startdate AND detentiondates.detentiondate != '$result_array2[result2]' "); $result3 = mysql_query($query3); Quote Link to comment Share on other sites More sharing options...
fenway Posted March 30, 2008 Share Posted March 30, 2008 Huh? Quote Link to comment Share on other sites More sharing options...
mwasif Posted March 30, 2008 Share Posted March 30, 2008 Look at Subquery. Quote Link to comment 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.