在PHP代码意外的T中解析错误

这个问题在这里已经有了答案:

  • PHP解析/语法错误; 以及如何解决它们? 13个答案

  • 请以这种方式尝试你的代码,

    <?php
    $con=mysqli_connect("localhost","my_user","my_password","my_db");
    // Check connection
    if (mysqli_connect_errno())
      {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
      }
    
    $sql="SELECT id, email FROM users WHERE id = 1";
    $result=mysqli_query($con,$sql);
    
    
    // Associative array
    $row=mysqli_fetch_assoc($result);
    printf("id = %s (%s)n", $row['id'], gettype($row['id']));
    printf("email = %s (%s)n", $row['email'], gettype($row['email']));
    
    // Free result set
    mysqli_free_result($result);
    
    mysqli_close($con);
    ?>
    
    链接地址: http://www.djcxy.com/p/69605.html

    上一篇: Parse error in PHP code unexpected T

    下一篇: Parse error: syntax error, unexpected T