$query="select * from table where name='".$_SESSION["name"];

解决方案 »

  1.   

    $query="select * from table where name=".$_SESSION['name']."";
      

  2.   

    $query="select * from table where name='$_SESSION[\"name\"]'";
    行不行?
      

  3.   

    $query="select * from table where name=".$_SESSION["name"];
      

  4.   

    $query="select * from table where name='".$_SESSION["name"]."'"
      

  5.   

    使用{}
    $query="select * from table where name='{$_SESSION["name"]}'";
    被{}括起的部分视为整体,看上去也舒服点。
      

  6.   

    晕,可以用session,为什么我不能用$row取值呢?用$sql = "SELECT * FROM $news_table WHERE keywords='$row(keyword)'";不能取值 
    用echo $row(keyword)";可以取到keyword的值 
    用echo $sql;取值时为空 
    为什么啊