邮件不会从收件箱中删除

时间:2013-01-04 12:55:39

标签: php sql-server-2005

我尝试从收件箱中删除邮件并将其移至垃圾箱文件夹,但我的代码无效。任何人都可以建议我。

    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 :(得分:0)

根据标题,您试图从收件箱中删除邮件,但是在您发布的代码中:

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

您还应该使用例如echo odbc_errormsg();(只是一个简单的示例)添加错误处理,以查看数据库调用发生了什么。