echo json_使用PHP错误编码

echo json_使用PHP错误编码,php,jquery,ajax,json,Php,Jquery,Ajax,Json,你知道这不起作用的原因吗 $result = mysql_query("SELECT cust_name, description from `projects` where project_no = '".$project_no."'") or die(mysql_error()); while ($row = mysql_fetch_array($result)) { echo json_encode(

你知道这不起作用的原因吗

$result = mysql_query("SELECT cust_name, description from `projects` where project_no = '".$project_no."'") or die(mysql_error());
            while ($row = mysql_fetch_array($result)) {
                echo json_encode(
                      array("message1" => '".$row['cust_name']."', 
                      "message2" => '".$row['description']."')
                 )
            }
这是错误:
Parse error:syntax error,意外的T_字符串,应为“'),位于第14行的/admin/customerfilter.php中

第14行是以“数组…”开头的行

谢谢:)

引用太多:

$result = mysql_query("SELECT cust_name, description from `projects` where project_no = '".$project_no."'") or die(mysql_error());
            while ($row = mysql_fetch_array($result)) {
                echo json_encode(
                      array("message1" => $row['cust_name'], 
                      "message2" => $row['description'])
                 )
            }

不要把事情弄得过于复杂。

添加缺少的部分;我的工作方式和编译器一样完美。仅修复报告的第一个错误:PThanks!太好了,我最不想做的就是把它复杂化:)让它工作吧!正确格式化你的代码,你会发现哪里出了问题。。。始终缩进并使用突出显示IDE/编辑器的语法,您将不会遇到此问题。。。
echo json_encode(array(
    "message1" => $row['cust_name'],
    "message2" => $row['description'],
));