-1

我遇到了关于解析错误的问题:语法错误,意外的 T_CONSTANT_ENCAPSED_STRING。我尝试了在线可用的所有解决方案,但仍然一遍又一遍地遇到相同的错误。

所以问题是:解析错误:语法错误,第 25 行 C:\wamp\www\RedCross\load.php 中的意外 T_CONSTANT_ENCAPSED_STRING

加载.php

<?php

include_once('connect.php');

$EventNum = $_POST['ename'];
//die('You sent: ' . $selStudent);

//Run DB query
$query = "SELECT Price FROM events WHERE EventID = '".$EventNum."' ";
$result = mysql_query($query) or die('Fn another_php_file.php ERROR: ' .    mysql_error());
$num_rows_returned = mysql_num_rows($result);
//die('Query returned ' . $num_rows_returned . ' rows.');

//Prepare response html markup
$r = "  
        <div class='control-group'>
            <label class='control-label' for='price'>Price </label>
                <div class='controls'>
";

//Parse mysql results and create response string. Response can be an html table, a full     page, or just a few characters
if ($num_rows_returned > 0) {   
    while ($row = mysql_fetch_array($result)) {    

    $r = $r . "<input type='text' name='price' id='price' class='input-xlarge'  value = " . $row['Price'] . " readonly>";

   }
     $r = $r .  "<center>
                <button type='submit' class='btn btn-large btn- danger' name='submit' id='submit'>Join!</button>
            </center>";

//The response echoed below will be inserted into the 
echo $r;
} else {
    $r = '<p>sorry there is no available staff for this</p>';
   // $r = $r . '</select><input type="submit" name ="go" value="press me">';
$r = $r . '</div></div>';

//The response echoed below will be inserted into the 
echo $r;
}

//Add this extra button for fun

?>

第 25 行是这段代码: 在此处输入图像描述

即使我在它之前放了空格,使这条线不在第 25 行,但错误仍然在第 25 行。

请帮忙。

4

1 回答 1

0

将第 25 行的代码更改为以下行并测试:

$r = $r . '<input type="text" name="price" id="price" class="input-xlarge"  value = ' . $row["Price"] . ' readonly>';
于 2013-11-02T10:08:21.057 回答