2014-10-19 73 views
0

我有我的PHP代碼查詢:PHP MySQL的請求錯誤:解析錯誤:語法錯誤,意想不到的 '%'

$result = mysqli_query($con,"UPDATE operasyonkayitlari SET tarihgun=FROM_UNIXTIME(UNIX_TIMESTAMP(NOW())-28800, "%Y.%m.%d"), tezgah='".$_REQUEST['tezgah']."', operatoradi='".$_REQUEST['operator']."', ayarepoch=UNIX_TIMESTAMP(NOW()), durum='AYARDA' where isemri='".$_REQUEST['isemri']."' and operasyonno='".$_REQUEST['operasyonno']."'"); 

看這密切:

FROM_UNIXTIME(UNIX_TIMESTAMP(NOW())-28800, "%Y.%m.%d") 

用%字符符號給我這個語法錯誤:

Parse error: syntax error, unexpected '%' in C:\wamp\www\ayarabasla.php on line 4 

我是如何用%符號編寫查詢的?

+1

我看到這樣的「錯誤」越來越多的SOF,你們不去做一些調試?你有沒有突出顯示的編輯?還有什麼更有線,錯誤顯示,但你不能看到它? – Dwza 2014-10-19 16:45:10

+0

我正在使用NotePad寫這個。我正在尋找一個很好的PHP IDE。他們說我phpStorm很好,但它太慢了,不適合我。你建議一些好的PHP IDE嗎? – Rictrunks 2014-10-19 16:52:20

回答

4

語法高亮顯示您的錯誤。這是一個報價問題。逃生你內心的雙引號:

$result = mysqli_query($con,"UPDATE operasyonkayitlari SET tarihgun=FROM_UNIXTIME(UNIX_TIMESTAMP(NOW())-28800, \"%Y.%m.%d\"), tezgah='".$_REQUEST['tezgah']."', operatoradi='".$_REQUEST['operator']."', ayarepoch=UNIX_TIMESTAMP(NOW()), durum='AYARDA' where isemri='".$_REQUEST['isemri']."' and operasyonno='".$_REQUEST['operasyonno']."'"); 

您可以使用單引號,太:

$result = mysqli_query($con,"UPDATE operasyonkayitlari SET tarihgun=FROM_UNIXTIME(UNIX_TIMESTAMP(NOW())-28800, '%Y.%m.%d'), tezgah='".$_REQUEST['tezgah']."', operatoradi='".$_REQUEST['operator']."', ayarepoch=UNIX_TIMESTAMP(NOW()), durum='AYARDA' where isemri='".$_REQUEST['isemri']."' and operasyonno='".$_REQUEST['operasyonno']."'"); 
+0

謝謝!我看不到我的報價錯誤,因爲我使用記事本:)我認爲我應該使用一些好的IDE。 – Rictrunks 2014-10-19 16:43:20

相關問題