连接字符串---解析错误:语法错误,意外T_STRING

时间:2012-02-14 02:26:48

标签: parsing

请帮忙,无法想出这个......这个文件是连接字符串搜索文件的一部分。

收到此错误 - “解析错误:语法错误,第33行意外T_STRING”

<?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;
?>

1 个答案:

答案 0 :(得分:0)

终止字符串文字

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