选择带有。$ row的语句

时间:2016-01-27 05:01:15

标签: php mysql

我想知道这个select语句有什么问题。 这是我得到的错误:

  

解析错误:语法错误,意外T_ENCAPSED_AND_WHITESPACE,   期待T_STRING或T_VARIABLE或T_NUM_STRING   第47行/home/www/mp28.bit-mp.biz/CardRegistration2.php

$query = "SELECT PlayerName FROM Players where TeamName = .$row['Team1']";

3 个答案:

答案 0 :(得分:1)

Str

应该是

$query = "SELECT PlayerName FROM Players where TeamName = .$row['Team1']";

答案 1 :(得分:0)

查询校正检查两个解决方案。两者都应该有效:

RETRIEVE

OR

session.get(MessageStoreInterceptor.fieldErrorsSessionKey)
session.get(MessageStoreInterceptor.actionErrorsSessionKey)
session.get(MessageStoreInterceptor.actionMessagesSessionKey)

$query = "SELECT PlayerName FROM Players where TeamName =" .$row['Team1'];

处的连接问题

答案 2 :(得分:0)

$query = "SELECT PlayerName FROM Players where TeamName = '".$row['Team1']."' ";

试试这个。 TeamName列是varchar,因此传递用quotes括起来的字符串。