错误:(!)解析错误:语法错误,意外''(T_ENCAPSED_AND_WHITESPACE),期待标识符(T_STRING)

时间:2016-02-10 09:16:18

标签: php mysql row

早上好

今天早上我遇到了一些与此搜索脚本有关的问题,我一直收到此错误

! ) Parse error: syntax error, unexpected '' (T_ENCAPSED_AND_WHITESPACE), expecting identifier (T_STRING) or variable (T_VARIABLE) or number (T_NUM_STRING) in C:\wamp\www\schoolmanagementsystem\search.php on line 24

我的源代码看起来像这样

<html>
<title>Search Records</title>
<head>
<body>
    <form name="" id="" method="post" action="search.php"/>
    <p> Enter Student name : <input type="text" name="fullname" id="fullname"/>
    <input type="submit" name="senda" value="Search Data" />

</form>

<?php
if(isset($_POST['senda'])){

    include 'mysqlconn.php';
    $con = mysqli_connect($host, $dbuser, $pass, $db) or die('Cannot Connect');

    $name = $_POST['fullname'];

        $sql = "SELECT * FROM scores WHERE fullname = '$name'";
        $result = mysqli_query($con,$sql)  or die("Error: ".mysqli_error($con));

    while($row = mysqli_fetch_array($result,MYSQLI_ASSOC))
    {
          echo"$row['Fullname'] .'  '. $row['studentNo'] .'  '. $row['SubjectName'] .'  '. $row['GPA'] .'  '. $row['CGPA'] .'  '. $row['SCORE']<br/>";  // Error here
    }
    mysqli_free_result($result);
     //$result->close();
    }

?>
</body>
</head>
</html>

需要认真帮助

2 个答案:

答案 0 :(得分:2)

echo $row['Fullname']."  ".$row['studentNo']."  ".$row['SubjectName']."  ".$row['GPA']."  ".$row['CGPA']."  ".$row['SCORE']."<br/>";  // Error here

答案 1 :(得分:0)

您必须从开始和结束"

中删除echo双引号

更改

  echo"$row['Fullname'] .'  '. $row['studentNo'] .'  '. $row['SubjectName'] .'  '. $row['GPA'] .'  '. $row['CGPA'] .'  '. $row['SCORE']<br/>";  // Error here

echo $row['Fullname'] . " ". $row['studentNo']. " ". $row['SubjectName'] . " ".  $row['GPA'] . " ".  $row['CGPA'] . " ".  $row['SCORE'] . " ".  $row['SubjectName'] . "<br/>";