我在我的應用程序中使用zend框架2。我想簡單地執行這個查詢...ZF2中的SQL查詢語法錯誤
$sql = "INSERT INTO tbl_group(group_name, group_order, version_id_fk, group_code)
SELECT group_name, group_order, {$newVersionId}, $this->getServiceLocator()->get('commonService')->randomMD5() FROM tbl_group
WHERE version_id_fk = {$versionArray['version_id_pk']}";
但我發現了這個錯誤:
SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ')->get('commonService')->randomMD5() FROM tbl_group WHERE version_id_fk ' at line 2
任何人都可以建議我如何解決這一問題?
謝謝!
你有''。 {RAND()})'在你的查詢中。當然,它不能被解析 –