SESSION['ye']";

This question already has an answer here:

  • PHP parse/syntax errors; and how to solve them? 13 answers

  • When interpolating array items into a string you need to use the complex interpolation syntax (wrap it in {} ):

    $sql = "SELECT DISTINCT `sem` from `{$_SESSION['ye']}`";
    

    It is generally simpler to just save the value to an auxiliary variable. It can make your code easier to read:

    $ye  = $_SESSION['ye'];
    $sql = "SELECT DISTINCT `sem` from `$ye`";
    

    First assign table name to variable

    $tableName = $_SESSION['ye'];
    

    Then use the variable name in query

    $sql = "SELECT DISTINCT sem from `$tableName`";
    

    Or simply use

    $sql = "SELECT DISTINCT sem from `". $_SESSION['ye']."`";
    

    使用这样的东西

    $sql="SELECT DISTINCT sem from ".$_SESSION['ye'];
    
    链接地址: http://www.djcxy.com/p/69940.html

    上一篇: php parse语法错误T

    下一篇: SESSION [ '你们']“;