当所有括号都闭合时,与括号相关的 PHP 语法错误
我不断收到此错误:解析错误:语法错误,第 67 行 /Users/skline/Sites/tiptap/Site/tiptap/survey_current.php 中出现意外的“}”
但是,我所有的括号都已关闭!我真的很困惑,提前谢谢。
<?php
$dbc = mysql_connect(DATABASE_HOSTNAME,DATABASE_USERNAME, DATABASE_PASSWORD);
if(!$dbc){
die('Not connected' .mysql_error());
}
// Select database
$db_selected = mysql_select_db(DATABASE_DATABASENAME, $dbc);
// If fails, exit and cry
if (!$db_selected)
{
die ("can't connect : " .mysql_error());
}
function getCurrentSurvey($consumer_id){
$last_survey_sql="SELECT DISTINCT ssr.SET_ID AS SET_ID,
ssr.SURVEY_ID AS SURVEY_ID
FROM branching_survey_responses AS bsr
JOIN survey_set_relation AS ssr
ON bsr.SET_ID=ssr.SET_ID
AND bsr.SET_ID=(SELECT Max(set_id)
FROM branching_survey_responses
WHERE CUSTOMER_ID=$consumer_id)
AND bsr.CUSTOMER_ID=$consumer_id;";
$last_survey_result=mysql_query($last_survey_sql);
$last_set= mysql_result($last_survey_result,0,"SET_ID");
$last_survey= mysql_result($last_survey_result,1,"SURVEY_ID");
$last_question_sql="SELECT DISTINCT QUESTION_ID
FROM branching_survey_responses
WHERE QUESTION_ID=(SELECT Max(QUESTION_ID)
FROM branching_survey_responses
WHERE CUSTOMER_ID=$consumer_id
AND SET_ID=$last_set)
AND CUSTOMER_ID=$consumer_id
AND SET_ID=$last_set;";
$last_question_result=mysql_query($last_question_sql);
$last_question=mysql_result($last_question_result, 0, "QUESTION_ID");
$survey_count_sql= "SELECT COUNT(*) AS survey_count
FROM surveytable;";
$survey_count_result=mysql_query($survey_count_sql);
$survey_count=mysql_result($suvery_count_result, 0, "survey_count");
$question_count_sql="SELECT Max(q.QUESTION_ID) AS question_count
FROM questions as q
JOIN branching_table as bt
ON bt.question_id=q.question_id
JOIN survey_set_relation as ssr
ON ssr.SET_ID=bt.SET_ID
AND ssr.SURVEY_ID=$last_survey;";
$question_count_result=mysql_query($question_count_sql);
$question_count=mysql_result($question_count_result, 0, "question_count");
$current_survey = array("last_survey"=>$last_survey, "last_question"=>$last_question, "survey_count"=>$survey_count, "last_survey"=>$question_count);
return $current_survey
}
$test=getCurrentSurvey(217);
echo $test['last_survey'];
echo $test['last_question'];
echo $test['survey_count'];
echo $test['question_count'];
?>
I keep geting this error: Parse error: syntax error, unexpected '}' in /Users/skline/Sites/tiptap/Site/tiptap/survey_current.php on line 67
However, all my brackets are closed! I am really confused, thanks in advance..
<?php
$dbc = mysql_connect(DATABASE_HOSTNAME,DATABASE_USERNAME, DATABASE_PASSWORD);
if(!$dbc){
die('Not connected' .mysql_error());
}
// Select database
$db_selected = mysql_select_db(DATABASE_DATABASENAME, $dbc);
// If fails, exit and cry
if (!$db_selected)
{
die ("can't connect : " .mysql_error());
}
function getCurrentSurvey($consumer_id){
$last_survey_sql="SELECT DISTINCT ssr.SET_ID AS SET_ID,
ssr.SURVEY_ID AS SURVEY_ID
FROM branching_survey_responses AS bsr
JOIN survey_set_relation AS ssr
ON bsr.SET_ID=ssr.SET_ID
AND bsr.SET_ID=(SELECT Max(set_id)
FROM branching_survey_responses
WHERE CUSTOMER_ID=$consumer_id)
AND bsr.CUSTOMER_ID=$consumer_id;";
$last_survey_result=mysql_query($last_survey_sql);
$last_set= mysql_result($last_survey_result,0,"SET_ID");
$last_survey= mysql_result($last_survey_result,1,"SURVEY_ID");
$last_question_sql="SELECT DISTINCT QUESTION_ID
FROM branching_survey_responses
WHERE QUESTION_ID=(SELECT Max(QUESTION_ID)
FROM branching_survey_responses
WHERE CUSTOMER_ID=$consumer_id
AND SET_ID=$last_set)
AND CUSTOMER_ID=$consumer_id
AND SET_ID=$last_set;";
$last_question_result=mysql_query($last_question_sql);
$last_question=mysql_result($last_question_result, 0, "QUESTION_ID");
$survey_count_sql= "SELECT COUNT(*) AS survey_count
FROM surveytable;";
$survey_count_result=mysql_query($survey_count_sql);
$survey_count=mysql_result($suvery_count_result, 0, "survey_count");
$question_count_sql="SELECT Max(q.QUESTION_ID) AS question_count
FROM questions as q
JOIN branching_table as bt
ON bt.question_id=q.question_id
JOIN survey_set_relation as ssr
ON ssr.SET_ID=bt.SET_ID
AND ssr.SURVEY_ID=$last_survey;";
$question_count_result=mysql_query($question_count_sql);
$question_count=mysql_result($question_count_result, 0, "question_count");
$current_survey = array("last_survey"=>$last_survey, "last_question"=>$last_question, "survey_count"=>$survey_count, "last_survey"=>$question_count);
return $current_survey
}
$test=getCurrentSurvey(217);
echo $test['last_survey'];
echo $test['last_question'];
echo $test['survey_count'];
echo $test['question_count'];
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
该行缺少分号。
Missing semicolon on this line.
返回 $current_survey ->丢失的 ”;”?
return $current_survey -> missing ";"?