2013-01-04 96 views
-2

我嘗試從收件箱中刪除郵件並將其移至垃圾郵件文件夾,但我的代碼無法正常工作。任何人都可以給我一些建議郵件不會從收件箱中刪除

if($attachment!="") 
    {    
     /* $outputList .='' . $send. '&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;' .$subject.'&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;'.$time.'<hr/>'; */ 

     /* $outputList .='<table><tr><td><input type="checkbox" class="check"></td><td style="width:30%;text-align:left">' . $send. '</td><td style="width:42%; text-align:left">' .$subject. '</td><td style="width:3%">' . $attach . '</td><td style="width:30%">'.$time.'</td></tr></table>'; */ 

     $outputList .='<table><tr><td><input type="checkbox" class="check"></td><td style="width:30%;text-align:left">'.$sender.'</td><td style="width:45%;text-align:left">'.$subject.'</td><td style="width:3%" align="left" >' . $attach . '</td><td style="width:30%">'.$time.'</td></tr></table>'; 
     } 
     else { 
      $outputList .='<table><tr><td><input type="checkbox[]" value=" $row["topic_id"]" class="check"></td><td style="width:30%;text-align:left">'.$sender.'</td><td style="width:45%;text-align:left">' .$subject. '</td><td style="width:3%" align="left" ></td><td style="width:30%">'.$time.'</td></tr></table>';    
     } 
    } 


    <div class="delete">   
     <input name="del" type="button" value="delete" action=""/> 
     <?php    
      include 'delete.php'; 

      if (isset($_POST['del']) && isset($_POST['check'])) 
     {    
      foreach($_POST['check'] as $del_id){ 
      $del_id = (int)$del_id; 
      $result= odbc_exec($conn,"insert into trash (sender,cc,bcc,subject,message,attachment,filename,filesize,date) 
select sender,cc,bcc,subject,message,attachment,filename,filesize,date from inbox where ID=$del_id"); 

     if($result==true) 
      { 
       $result= odbc_exec($conn,"delete from sent where ID=$del_id"); 
       $move="message deleted"; 
      }else 
       $move="cannot delect the mail"; 
      } 
     } 
    ?>   
    </div> 
+1

您應該在發佈之前查看您的代碼 –

回答

0

根據你想從你的收件箱中刪除郵件的標題,但是在你的代碼,你後:

delete from sent where ID=$del_id 
      ^^^^ sent != inbox 

您還應該添加錯誤處理,例如使用echo odbc_errormsg();(只是一個簡單的例如),看看數據庫調用發生了什麼。