主题:  为什么数据删除只能删除1条,不能删除一串记录啊。救命啊。

sunslee

职务:普通成员
等级:1
金币:0.0
发贴:107
#12004/11/8 13:39:24
    switch($subtype)
    {
        case "add":
            $title=addslashes($title);
            $content=addslashes($content);
            $type=addslashes($type);
            $from=addslashes($from);
            $author=addslashes($author);
            $date=addslashes($date);

            $sql="insert into news set newstitle='$title',newscontent='$content',newstype='$type',newsfrom='$from',newsauthor='$author',newsdate='$date'";
            $result=mysql_query($sql);
            if ($result)
            {
                echo "<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle' class='titlewhite'>数据库更新成功,系统将在2秒中后返回,如需要手动返回请点击&nbsp;[&nbsp;<a href='newslist.php' target='rightframe' class='menu'>这里</a>&nbsp;]</td></tr></table>";
            }
            else
            {
                echo "<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle' class='titlewhite'>数据库更新失败,系统将在2秒中后返回,如需要手动返回请点击&nbsp;[&nbsp;<a href='newslist.php' target='rightframe' class='menu'>这里</a>&nbsp;]</td></tr></table>";
            }
        break;
        case "edit":
            $title=addslashes($title);
            $content=addslashes($content);
            $type=addslashes($type);
            $from=addslashes($from);
            $author=addslashes($author);
            $date=addslashes($date);

            $sql="update news set newstitle='$title',newscontent='$content',newstype='$type',newsfrom='$from',newsauthor='$author',newsdate='$date' where newsid=$id ";
            $result=mysql_query($sql);
            if ($result)
            {
                echo "<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle' class='titlewhite'>数据库更新成功,系统将在2秒中后返回,如需要手动返回请点击&nbsp;[&nbsp;<a href='newslist.php' target='rightframe' class='menu'>这里</a>&nbsp;]</td></tr></table>";
            }
            else
            {
                echo "<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle' class='titlewhite'>数据库更新失败,系统将在2秒中后返回,如需要手动返回请点击&nbsp;[&nbsp;<a href='newslist.php' target='rightframe' class='menu'>这里</a>&nbsp;]</td></tr></table>";
            }
        break;
        case "del":
            #echo "$cone";
            $sql="delete from news where newsid in ('$cone')";
            $result=mysql_query($sql);
            if ($result)
            {
                echo "<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle' class='titlewhite'>数据库更新成功,系统将在2秒中后返回,如需要手动返回请点击&nbsp;[&nbsp;<a href='newslist.php' target='rightframe' class='menu'>这里</a>&nbsp;]</td></tr></table>";
            }
            else
            {
                echo "<table width='90%' height='90%' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle' class='titlewhite'>数据库更新失败,系统将在2秒中后返回,如需要手动返回请点击&nbsp;[&nbsp;<a href='newslist.php' target='rightframe' class='menu'>这里</a>&nbsp;]</td></tr></table>";
            }
        break;
    }