ec Posted April 16, 2008 Share Posted April 16, 2008 <?php echo '<form>'; $query1 = mysql_query("SELECT detentiondate FROM detentiondates WHERE detentiondate NOT IN (SELECT detentiondate FROM detention WHERE '".$_SESSION['pupilno']."' = pupilno)"); while ($row = mysql_fetch_assoc($query1)){ echo "$row[detentiondate]"; echo "<input type='radio' name='choice' value='{$row['detentiondate']}'><br>"; } I'm trying to add more to this query so that only dates which are 3 days or more away from today would be displayed as the result of this query. Anyone any ideas? I've tried adding in $t=getdate(); $currentdate=date('Y-m-d',$t[0]); $newcurrentdate = date("Y-m-d", mktime(0,0,0, date(m), date(d)+3,date(Y))); and then variations to the end of the query like AND IF $newcurrentdate < detentiondate but nothing's been working... Quote Link to comment https://forums.phpfreaks.com/topic/101334-querying/ Share on other sites More sharing options...
Cep Posted April 16, 2008 Share Posted April 16, 2008 This not correct! But it should give you an idea <?php $sql = mysql_query("SELECT detentiondate FROM detentiondates WHERE detentiondate <= {$dateplus3} AND pupilno != '".$_SESSION['pupilno']."')"); ?> Quote Link to comment https://forums.phpfreaks.com/topic/101334-querying/#findComment-518309 Share on other sites More sharing options...
sasa Posted April 16, 2008 Share Posted April 16, 2008 $query1 = mysql_query("SELECT detentiondate FROM detentiondates WHERE detentiondate NOT IN (SELECT detentiondate FROM detention WHERE '".$_SESSION['pupilno']."' = pupilno) AND '$newcurrentdate' < detentiondate"); Quote Link to comment https://forums.phpfreaks.com/topic/101334-querying/#findComment-518447 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.