2013-10-01 69 views
-1

我有關於解析錯誤的問題:語法錯誤,意外的T_CONSTANT_ENCAPSED_STRING。我嘗試了所有可用的在線解決方案,但仍然一遍又一遍地得到了同樣的錯誤。解析錯誤:語法錯誤,意外T_CONSTANT_ENCAPSED_STRING

所以問題是:解析錯誤:語法錯誤,在C意想不到T_CONSTANT_ENCAPSED_STRING:\ WAMP \ WWW \ RedCross \ load.php上線25

load.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驗證碼: enter image description here

即使我把之前的空間讓這條線不符合25還是錯誤是第25行

請幫忙。

+0

[不使用mysql_ *分機(http://www.php.net/en/mysql_query),因爲它已被棄用。改爲使用[PDO](http://php.net/manual/en/book.pdo.php)或[MySQLi](http://php.net/manual/en/book.mysqli.php)。 –

+0

您發佈的整個代碼中沒有語法錯誤,它解析得很好。 (_「即使我在第25行將此行放在第25行之前仍然留有空格,但錯誤仍然在第25行中,」這更像是一個指標,表明您最有可能在錯誤的地方查看。)除此之外,您至少應該學習語法的基礎知識,以便您可以自己修復簡單的分析錯誤。 – CBroe

回答

0

變化線25中的代碼,以低於線路和測試:

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