-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>
4

1 回答 1

0

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

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

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

于 2013-01-04T13:13:00.060 回答