Home > Backend Development > PHP Tutorial > 这个delete删除 哪里异常了

这个delete删除 哪里异常了

WBOY
Release: 2016-06-13 10:09:03
Original
1169 people have browsed it

这个delete删除 哪里错误了?



 
 




$con = @mysql_connect("localhost","root","")or die("failed to connect the database");
mysql_select_db("iccp",$con);
mysql_query("set names 'GBK'");
$sql="select * from t_paper where contributor_id=118";
$query = mysql_query($sql);
while($row=mysql_fetch_array($query)){
?>







Paper Title

Comments

Upload Date

Delete

=@$row['paper_title']?> =@$row['upload_time']?>

}
if(!empty($_POST['name'])){
$str = explode(",",$_POST['name']);
  mysql_query("delete from t_paper where paper_title in($str)");}
?>


这里测试 为什么无法得到$_POST['name']的值

------解决方案--------------------
form 表单都没
------解决方案--------------------
另外,判断表单是否被提交应该用isset()
PHP code
if (isset($_POST['name'])) {    $str = explode(",",$_POST['name']);    mysql_query("delete from t_paper where paper_title in($str)"); //这里明显有问题,explode()函数返回的是一个数组,SQL语句语法错误了}<div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template