<?
  require("session.php");
  $class_id=$_GET['id'];
  $username=$_GET['username'];
  $link_id=mysql_connect($dbhost,$dbuser,$dbpassword);
  mysql_select_db($dbname,$link_id);
  $str="delete from class where class_id = '$class_id ' and username= ' $username ' ";
  $result=mysql_query($str,$link_id);
  if($result)
  echo"<script language='javascript'>alert('企业信息删除成功,点击确定返回');</script>";
  mysql_close($link_id);
  echo"<script language=javascript>window.location.href='qiye_view.php'</script>";
  ?>

解决方案 »

  1.   

    $str="delete from class where class_id = '$class_id ' and username= ' $username ' ";
    错的
      

  2.   

    ''不解析php变量
    $str="delete from class where class_id = '".$class_id."'  and username= '". $username ."' ";
      

  3.   

    $str="delete from class where class_id = '$class_id' and username= '$username' ";
    这条语句应该可以了,你语句里面多了空格的
      

  4.   

    当然删不掉,你附加了空格!!!$str="delete from class where class_id = '$class_id ' and username= ' $username ' ";
    应写作
    $str="delete from class where class_id = '$class_id' and username= '$username' ";
      

  5.   

    username= ' $username ' 
    username= '$username' 
      

  6.   

    去掉空格也不行,$str在数据库中直接执行没问题,可以删除,就是在php中就不行~
      

  7.   

    如果但执行:
    $str="delete from class where class_id = '$class_id';
    就可以删除,再加一个条件
      and username='$username';
    就删除不了~