2017-05-07 28 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

如果你打算追求脫離主題的語法/拼寫錯誤,至少......讓他們都知道 –

相關問題