2012-02-14 139 views
0

請幫忙,不能把這一個弄出來......這個文件是連接字符串搜索文件的一部分。連接字符串---解析錯誤:語法錯誤,意外T_STRING

得到這個錯誤 - 「解析錯誤:語法錯誤,意想不到的T_STRING在第33行」

<?php 
define(HOST, "localhost"); 
define(USER, "****"); 
define(PW, "*****"); 
define(DB, "******"); 

$connect = mysql_connect(HOST,USER,PW) 
or die('Could not connect to mysql server.'); 

mysql_select_db(DB, $connect) 
or die('Could not select database.'); 


$term = strip_tags(substr($_POST['search_term'],0, 100)); 
$term = mysql_escape_string($term); 


$sql = "select * from short_int 
where ticker like '%$term%'; 

$result = mysql_query($sql); 


$string = ''; 

if (mysql_num_rows($result) > 0){ 
    while($row = mysql_fetch_object($result)){ 
    $string .= "<b>".$row->Ticker."</b>"; 
    $string .= "<br/>\n"; 
    $string .= ".$row->:Last-Term."; 
    $string .= "<br/>\n"; 
    } 

}else{ 
    $string = "No matches!"; 
} 

echo $string; 
?> 

回答

0

終止字符串字面

$sql = "select * from short_int 
where ticker like '%$term%'"; 
相關問題