-4

以下のコードを実行するたびに、解析エラーが発生します:構文エラー、予期しない'}'、予期する'、'、または';' 52行目のC:\ wamp \ www \ bee \ hivedetails.phpにあります。コードを確認しましたが、(私には)正しく見えます。どんな助けでも大歓迎です。

<?php $HiveID=htmlspecialchars($_GET["HiveID"]); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
    <title>Hive Track</title>
    <link rel="stylesheet" type="text/css" href="style.css" />

    <!--[if IE]>
        <style type="text/css">
            #content {width: 770px; border-left: 2px solid #D1D1D1; border-right: 2px solid #D1D1D1; padding: 15px; margin: 0; background: url('images/content-bg.png');}
            table {border: 2px solid #AAAAAA;}
        </style>
    <![endif]-->

    <!--[if IE 9]>
        <style type="text/css">
            #content {width: 766px; margin: 0 auto; padding: 15px; background: url('images/content-bg.png');}
            table {border: 3px solid white; box-shadow: 0 0 10px #AAAAAA;}
        </style>
    <![endif]-->
</head>
<body>
    <div id="page">
        <div id="title">
            <h1>Hive Track</h1>
            <p></p>
        </div>

        <div id="body">
            <div id="nav">
                <ul>
                    <?php include 'nav.php'; ?>
                </ul>
            </div>

            <div id="header">
            </div>

            <div id="content">
                <?php if ($HiveID>=1) { echo "<h1>Hive Details</h1>";
                } else { echo "<h1>Create A New Hive</h1>";
                } ?>

                <?php if ($HiveID>=1) { echo
                "<?php mysql_select_db('hives'); 
                $query = mysql_query(' . SELECT * FROM hives WHERE HiveID = '$HiveID'') or die(mysql_error()); 
                if(mysql_num_rows($query)>=1){
                while($row = mysql_fetch_array($query)) {
                $hivename = " . $row["HiveName"] . ";
                $location = " . $row["LocationID"] . ";
                } }?>" } else { echo
                "$hivename='';$location='';" } ?>

                <h5></h5><br>
                <?php if ($HiveID>=1) {
                echo "Hive ID: " . $HiveID;
                } ?>
                <form action="hivedetailprocess.php" method="post">
                <input type="hidden" name="HiveID" value=<?php echo $HiveID; ?>>
                Hive Name: <input type="text" name="hivename" value=<?php echo $hivename; ?>> <br>





                <br><br>

                <!--<h5>Code</h5><br>
                <code>&lt;div&gt;&lt;p&gt;This is a code box.&lt;/p&gt;&lt;/div&gt;</code>


                <br><br><br><br>

                <h5>Blockquote</h5><br>
                <blockquote>"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec purus tortor, adipiscing sed vehicula ut, condimentum in arcu. Fusce hendrerit massa non velit dictum a laoreet felis consectetur."</blockquote>


                <br><br>

                <h5>Lists</h5>
                <ol>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                </ol>
                <ul>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                </ul>-->

            </div>

            <div id="footer">
                <p><a href="">Website Name</a></p>
            </div>
        </div>
    </div>
</body>

4

2 に答える 2

4

51行目と52行目の両方のエコーの後にセミコロンが必要です

     } }?>"; } else { echo
     "$hivename='';$location='';"; } ?>
于 2012-11-11T23:48:51.447 に答える
0

これがあなたの作業コードです

<?php $HiveID=htmlspecialchars($_GET["HiveID"]); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
 <html xmlns="http://www.w3.org/1999/xhtml">
<head profile="http://www.w3.org/2005/10/profile">
    <title>Hive Track</title>
    <link rel="stylesheet" type="text/css" href="style.css" />

    <!--[if IE]>
        <style type="text/css">
            #content {width: 770px; border-left: 2px solid #D1D1D1; border-right: 2px solid #D1D1D1; padding: 15px; margin: 0; background: url('images/content-bg.png');}
            table {border: 2px solid #AAAAAA;}
        </style>
    <![endif]-->

    <!--[if IE 9]>
        <style type="text/css">
            #content {width: 766px; margin: 0 auto; padding: 15px; background: url('images/content-bg.png');}
            table {border: 3px solid white; box-shadow: 0 0 10px #AAAAAA;}
        </style>
    <![endif]-->
</head>
<body>
    <div id="page">
        <div id="title">
            <h1>Hive Track</h1>
            <p></p>
        </div>

        <div id="body">
            <div id="nav">
                <ul>
                    <?php include 'nav.php'; ?>
                </ul>
            </div>

            <div id="header">
            </div>

            <div id="content">
                <?php if ($HiveID>=1) { echo "<h1>Hive Details</h1>";
                } else { echo "<h1>Create A New Hive</h1>";
                } ?>

                <?php if ($HiveID>=1) { echo
                "<?php mysql_select_db('hives'); 
                $query = mysql_query(' . SELECT * FROM hives WHERE HiveID = '$HiveID'') or die(mysql_error()); 
                if(mysql_num_rows($query)>=1){
                while($row = mysql_fetch_array($query)) {
                $hivename = " . $row["HiveName"] . ";
                $location = " . $row["LocationID"] . ";
                } }?>";  } else { echo
                "$hivename='';$location='';" ; } ?>

                <h5></h5><br>
                <?php if ($HiveID>=1) {
                echo "Hive ID: " . $HiveID;
                } ?>
                <form action="hivedetailprocess.php" method="post">
                <input type="hidden" name="HiveID" value=<?php echo $HiveID; ?>>
                Hive Name: <input type="text" name="hivename" value=<?php echo $hivename; ?>> <br>





                <br><br>

                <!--<h5>Code</h5><br>
                <code>&lt;div&gt;&lt;p&gt;This is a code box.&lt;/p&gt;&lt;/div&gt;</code>


                <br><br><br><br>

                <h5>Blockquote</h5><br>
                <blockquote>"Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec purus tortor, adipiscing sed vehicula ut, condimentum in arcu. Fusce hendrerit massa non velit dictum a laoreet felis consectetur."</blockquote>


                <br><br>

                <h5>Lists</h5>
                <ol>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                    <li>Ordered List Item</li>
                </ol>
                <ul>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                    <li>Unordered List Item</li>
                </ul>-->

            </div>

            <div id="footer">
                <p><a href="">Website Name</a></p>
            </div>
        </div>
    </div>
</body>
于 2012-11-12T00:17:54.503 に答える