doubi2228 2015-02-27 04:26
浏览 40
已采纳

解析错误:语法错误,第84行的C:\ xampp \ htdocs \ inc \ data_forms \ weight_routine_selector.php中的意外文件结束

please some one help me am getting an parse error while inserting data into mysql database through my script

ive also changed its code like to:

?>

still not working... its showing the same error as unexpected ending and thanks in advance ........##

<?php
$conn = connect($config['db']);
if (!$conn)
    die("Could not connect to DB");
$user_id       = $_SESSION['myuserid'];
$user_row      = user_information_row($conn, $user_id);
$routine_names = get_active_routine_names($conn, $user_id);
?>

<style>
    .selection_block{
        background: rgb(119, 193, 88);
    }
</style>



<div class="page">
    <div class="information">
    <div class="title_nav">
        <h1 style="display:inline;">Add Inputs</h1>
        <p><a href="input?weights">view</a></p> 
        <p><a href="input?n">add</a></p>
        <p><a href="input?n_edit">edit</a></p> 
        <p><a href="input">| menu</a></p> 
    </div>

<form action="" method="post">     

    <?php
if (count($routine_names)):
?> 

    <?php
    if ($user_row['help']):
?>
      <div class="help">
        Select the routine you wish to use!
      </div>
    <?php
    endif;
?>

    <p>Select today's routine!</p>    
    <div> 
        <?php
    foreach ($routine_names as $name) {
        $exercise_ids_query = $conn->query("SELECT exerciseIdF FROM tbl_routines WHERE userIdF = $user_id AND routineName = '$name' AND active = TRUE");
        $exercise_ids       = $exercise_ids_query->fetchALL(PDO::FETCH_ASSOC);
        $str_exercise_names = "";
        foreach ($exercise_ids as $exerciseId) {
            $id                  = $exerciseId['exerciseIdF'];
            $exercise_name_query = $conn->query("SELECT name FROM tbl_exercises WHERE exerciseId = $id AND active = true");
            $exercise_name       = $exercise_name_query->fetchALL(PDO::FETCH_ASSOC);
            $str_exercise_names .= $exercise_name[0]['name'] . ', ';
        }
        $str_exercise_names = substr($str_exercise_names, 0, -2);
        $str_exercise_names .= '.';
        echo '<a href="input?n&name=' . $name . '"><div class="routine_selection"><p>' . $name . ' - ' . $str_exercise_names . '</p></div></a>';
    }
?> 
    </div>

    <?php
else:
?>
        <div class="help">
            No active routines, click <a href="input.php?r"style="text-decoration: underline; font-weight:bold; color:white">here</a> to make one.
        </div> 
    <?
endif;
?>
</form>
    
    </div>
</div>

<?php
if (isset($_GET['input_status'])){
    echo "<div id=\"notify\" class=\"success\">" . $_GET['input_status'] . "</div>";
}
?>

Please help me in this

</div>
  • 写回答

1条回答 默认 最新

  • dongnao9525 2015-02-27 04:37
    关注

    The problem with your code is that you have an <? in

    <?
    endif;
    ?>
    

    which if short open tags are not set, then it will cause that parse error.

    Either you enable them, or change <? to <?php

    More on short open tags:


    Additional notes.

    If you have more code that you're not showing us and it contains <?= then that will also add to the problem.

    You would need to change <?= to <?php echo as <?= is short tag syntax for <?php echo.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 安卓adb backup备份应用数据失败
  • ¥15 eclipse运行项目时遇到的问题
  • ¥15 关于#c##的问题:最近需要用CAT工具Trados进行一些开发
  • ¥15 南大pa1 小游戏没有界面,并且报了如下错误,尝试过换显卡驱动,但是好像不行
  • ¥15 没有证书,nginx怎么反向代理到只能接受https的公网网站
  • ¥50 成都蓉城足球俱乐部小程序抢票
  • ¥15 yolov7训练自己的数据集
  • ¥15 esp8266与51单片机连接问题(标签-单片机|关键词-串口)(相关搜索:51单片机|单片机|测试代码)
  • ¥15 电力市场出清matlab yalmip kkt 双层优化问题
  • ¥30 ros小车路径规划实现不了,如何解决?(操作系统-ubuntu)