2017-05-07 85 views
-2

我无法使$ firstname等于$ row ['Firstname']。与姓氏一样。尝试检索数据并存储为变量时获取意外的T_STRING

$locationsQuery='select Firstname, Lastname, from locations where 
username=$username; 
$results = sqlsrv_query($conn, $locationsQuery, array($desiredusername)); 
while($row = sqlsrv_fetch_array($results)) 
{ 
$firstname = $row['Firstname']; 
$lastname = $row['Lastname']; 
} 
+0

前,距离实际代码这个复制/粘贴?如果是这样,那么在查询后你就会错过关闭'''。 – rickdenhaan

+0

'$ locationsQuery'变量缺少单引号''' – Thamilan

+0

看看突出显示.. – chris85

回答

-1

你缺少一个'在含$locationsQuery第一线的末端,在;

+1

https://meta.stackexchange.com/questions/174389/should-we-answer-or-comment-on-a-typo-question – chris85

+0

如果你打算追求脱离主题的语法/拼写错误,至少......让他们都知道 –

相关问题