连接mysql时unexpected T_ENCAPSED_AND_WHITESPACE错误
程序员文章站
2024-04-04 16:50:17
...
$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
但出错的那行是注释掉了的呀
原因到底在哪里呢
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'";
推荐阅读
-
连接mysql时unexpected T_ENCAPSED_AND_WHITESPACE错误
-
在与SQLServer建立连接时出现与网络相关的或特定于实例的错误解
-
使用 Yii在高并发时,发生连接mysql数据库失败,求解释,该如何解决
-
Ubuntu VPS中wordpress网站打开时提示”建立数据库连接错误”的解决办法
-
phpCMS安装时提示MySQL扩展连接失败 博客分类: PHP phpcmsmysqlapachewindows
-
解决远程连接mysql错误1130 博客分类: mysql mysql
-
解决远程连接mysql错误1130 博客分类: mysql mysql
-
对于Navicat连接 MySQL 8.0 出现1251错误
-
JPA连接Mysql数据库时提示:Table 'jpa.sequence' dosen't exisit
-
连接ACCESS数据库时发生错误提示:找不到可安装的 ISAM