解析错误:语法错误,一条记录上出现意外的T_CONSTANT_ENCAPSED_STRING?

时间:2013-08-28 20:12:23

标签: php

我收到此错误:

解析错误:语法错误,意外T_CONSTANT_ENCAPSED_STRING,期待','或';'在第30行的/home/content/72/11648872/html/swtb/secure/talentsearch.php

但是,我只在表格的第二个条目中得到它,其他的都没问题。这让我感到困惑。希望它只是一两个字符(我是PHP / AJAX / JQUERY的新手)。

脚本:

<?php
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");

$q=$_GET["q"];

$con = mysqli_connect('1','2','3','4');
if (!$con)
  {
  die('Could not connect: ' . mysqli_error($con));
  }

mysqli_select_db($con,"ajax_demo");
$sql="SELECT CandidateID, Town, SalaryMin, CandidateExperience, PrimarySector FROM Candidates WHERE CandidateID = '".$q."'";

$result = mysqli_query($con,$sql);


while($row = mysqli_fetch_array($result))
  {
  echo "<div id='talent_result_wrapper'>";
  echo "<table>";  
  echo "<tr>";
  echo "<tr><td>" . $row['CandidateID'] . "</td></tr>";
  echo "<tr><td>" . $row['Town'] . "</td></tr>";
  echo "<tr><td>" . $row['SalaryMin'] . "</td></tr>";
  echo "<tr><td>" . $row['CandidateExperience'] . " Years </td></tr>";
  echo "<tr><td>" . $row['PrimarySector'] . "</td></tr>";
  echo "</tr>";
  echo "</table>";
  echo "</div>";
  }

mysqli_close($con);
?>

我已经仔细检查了,数据库中没有duff数据。我甚至尝试了在第一行和第二行中具有完全相同信息的新数据集。

有人可以帮忙吗?

1 个答案:

答案 0 :(得分:0)

毕竟这似乎是个问题。

交换引号。

echo "<div id='talent_result_wrapper'>";