2013-02-07 2 views
0

안녕하십니까.이 장학금 신청서 상자를 업데이트하려고합니다. 그러나 2013 년으로 바뀐 2013 년도의 장학금 신청자 정보 만 표시됩니다. 2012 년부터 정보를 표시하고 싶습니다. 날짜를 어지럽 혀 지려고했지만 그럴 수없는 것 같습니다. 어떤 도움이라도 대단히 감사하겠습니다!지난 연도 데이터를 테이블에서 꺼내십시오.

<?php 
$appYear = date("Y").'-'.(date("Y")+1); 
$sql = 'select * from sApplication where studentID = "'.$database->iPrep($_SESSION['ID']).'" AND appYear = "'.$appYear.'" LIMIT 1'; 
$appID = Scholarship::iFindSQL($sql); 
$total = count($appID); 
if ($total > 0) 
    { 
     $app = array_shift($appID); 
    } 
    else 
     { 
      $app = 0; 
     } 
?> 
<li id="item-2"> 
    <div id="appStatus"> 
    <h3>Application Status</h3> 
    <blockquote> 
    <?php if ($app->submitted == ('0000-00-00') || !isset($app->submitted)) { ?> 

    <table style="border:1px solid #000;" width="100%" border="0" cellspacing="5" cellpadding="0"> 
    <tr> 
    <td width="50%"><strong>Scholarship<br /> 2013-2014</strong></td> 
    <td width="50" align="right"> <a style="font-size:16px;" href="welcome.php? app=Scholar">Apply Now</a></td> 
    </tr> 
    <tr> 
    <td><strong>Date Submitted</strong></td> 
    <td align="right">&nbsp;</td> 
    </tr> 
    <tr> 
    <td><strong>References</strong></td> 
    <td align="right">&nbsp;</td> 
    </tr> 
    <tr> 
    <td><strong>Decision</strong></td> 
    <td>&nbsp;</td> 
    </tr> 
    <tr> 
    <td colspan="2"><hr /></td> 
    </tr> 
    <tr> 
    <td><strong>Scholarship 2012-2013</strong></td> 
    <td>&nbsp;</td> 
    </tr> 
    <tr> 
    <td><strong>Decision</strong></td> 
    <td>&nbsp;</td> 
    </tr> 
    </table> 



     <?php } else { ?> 
     <table style="border:1px solid #000;" width="100%" border="0" cellspacing="5" cellpadding="0"> 

     <tr> 
      <td width="90%"><strong>Scholarship 2013-2014</strong></td> 
      <td width="10%" align="right">&nbsp;</td> 
     </tr> 
     <tr> 
      <td><strong>Date Submitted</strong></td> 
      <td align="right"><?=dbOutDate($app->submitted)?></td> 
     </tr> 
     <tr> 
      <td><strong>References</strong> </td> 
      <td align="right"></td> 
     </tr> 

     <tr> 
     <td colspan="2"> 
     <?php 
     $refs = Reference::iFindSQL("Select * from reference where appID = '".$app->ID."'");?> 

     <table width="100%" border="0" cellspacing="0" cellpadding="0"> 

     <?php foreach($refs as $ref) { ?> 
     <tr> <td> <small><?php if($ref->rType == 'Academic Reference'){ echo 'Academic/Artistic/Professional'; } else { echo 'Community Service'; } ?></small></td> <td align="right"><?=$ref->status?></td></tr> 
     <?php } ?> 

     </table> 
     </td> 
     </tr> 
     <tr> 
      <td><strong>Decision</strong></td> 
      <td align="right"> 
     <?php 
       if ($app->complete == 'Approved') { echo '<a href="'.$_SERVER['PHP_SELF'].'?app=Bank&appID='.$app->ID.'">Approved</a>'; } 
       if ($app->complete == 'Declined') { echo '<a href="'.$_SERVER['PHP_SELF'].'?app=Declined&appID='.$app->ID.'">Declined</a>'; } 
       if ($app->complete == 'Pending') { echo 'Pending'; } 
       if ($app->complete == 'Incomplete') { echo 'Incomplete'; } 

답변

1

연도를 제한하는 WHERE 절을 제거하십시오. ORDER BY를 사용하여 연도별로 내림차순으로 정렬하십시오.

$sql = 'select * from sApplication 
    where studentID = "'.$database->iPrep($_SESSION['ID']). 
    '" ORDER BY appYear DESC LIMIT 1'; 
관련 문제