连接mysql时unexpected T_ENCAPSED_AND_WHITESPACE错误

WBOY
Release: 2016-06-23 14:08:57
Original
1331 people have browsed it

$m_dblink=mysql_connect("xxx","user","passwore",true)or die('Could not connect database in host');
mysql_select_db("check",$m_dblink) or die('Could not select database');
mysql_query("SET NAMES UTF8",$m_dblink);
$query="SELECT a.qa,a.svn_url,a.notifylist,b.tablename,b.file,b.level,b.description FROM result as b,svnurl_check_list AS a WHERE a.line=\"search\" and a.line = b.line
 and b.result=\"fail\";
echo $query,PHP_EOL;
$result = mysql_query($query,$m_dblink) or die('uery failed:' );
$count = mysql_num_rows($result);
for($index=0; $index          $row = mysql_fetch_array($result, MYSQL_ASSOC);
        //$tablename= $row['tablename'];//这就是出错的那行
        print_r($row);
        //echo " tablename:$tablename";
}
mysql_free_result($result);
mysql_close($m_dblink);

报了下面的错误:
PHP Parse error:  syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in line 36
但出错的那行是注释掉了的呀
原因到底在哪里呢


回复讨论(解决方案)

$query="SELECT a.qa,a.svn_url,a.notifylist,b.tablename,b.file,b.level,b.description FROM result as b,svnurl_check_list AS a WHERE a.line=\"search\" and a.line = b.line
 and b.result=\"fail\"";

问题在这里
$query="SELECT a.qa,a.svn_url,a.notifylist,b.tablename,b.file,b.level,b.description FROM result as b,svnurl_check_list AS a WHERE a.line=\"search\" and a.line = b.line
 and b.result= \"fail\";
应写作
$query="SELECT a.qa,a.svn_url,a.notifylist,b.tablename,b.file,b.level,b.description FROM result as b,svnurl_check_list AS a WHERE a.line=\"search\" and a.line = b.line
 and b.result= 'fail'";

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!