大型MySQL INSERT语句导致PHP错误

时间:2014-02-22 20:07:57

标签: php mysql insert-into

嗯,我正在制作我的代码,但是出现了一些奇怪的事情,我不认为我的代码是错的......但它仍然在死,我不知道为什么......

有错误:

Error: 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 'release, media_img, media_video, req) VALUES ('games_2' ,'GTA IV', 'aa', 'PC, Xb' at line 1

还有查询:

 INSERT INTO gamedata (item_id, name, gamedesc, platform, dev, distributor, genre, players, lang, age, release, media_img, media_video, req) VALUES ('games_2' ,'GTA IV', 'aa', 'PC, Xbox 360, PS3', 'RockStar Games', 'Take 2', 'Acción, Aventura, Shooter', '1, 2-32 (online) (Competitivo: 2-16 / Cooperativo: 2-8)', 'Manual: Español, Textos: Español, Voces: Inglés', '3', '1228284000', 'a:1:{i:0;s:265:"http://media.gtanet.com/images/4498-gta-iv-screenshot.jpg\r\nhttp://media.gtanet.com/images/4590-gta-iv-screenshot.jpg\r\nhttp://media.gtanet.com/images/4499-gta-iv-screenshot.jpg\r\nhttp://www.thegtaplace.com/images/gta4/screenshots/pc/gta-iv-pc-screenshot_045.jpg";}', 'a:1:{i:0;s:42:"http://www.youtube.com/watch?v=Fh2egiqQY8A";}', 'Requisitos mínimos:\r\n\r\nSistema Operativo: Windows Vista SP1 / Windows XP SP3\r\nProcesador: Intel Core 2 Duo 1.8 Ghz, AMD Athlon X2 64 2.4 Ghz\r\nMemoria: 1.5GB Windows Vista / 1GB Windows XP\r\nEspacio en Disco: 16GB libres\r\nGráfica: 256MB NVIDIA 7900 / 256MB ATI X1900\r\nRequisitos recomendados:\r\n\r\nSistema Operativo: Windows Vista SP1 / Windows XP SP3\r\nMicroProcesador: Intel Core 2 Quad 2.4Ghz, AMD Phenom X3 2.1Ghz\r\nRAM: 2.5GB Windows Vista / 2.5GB Windows XP\r\nEspacio en Disco: 18GB libres\r\nGráfica: 512 MB NVIDIA 8600 / 512MB ATI 3870\r\nOtros: DVD-ROM de doble capa')

有一个原始版本:http://pastebin.com/jgLcXbe1

是的,它太大了,但我不知道它是否存在问题,或者我错误地写了一些东西: - /

感谢。

PD:奇怪的是,一切都是正确的,表格中的所有行,以及您可以看到的所有数据......但由于某种原因,PHP会给我带来错误。 ..

1 个答案:

答案 0 :(得分:3)

RELEASE是mysql保留的关键字,你应该通过反引号来围绕它,就像那样:

INSERT INTO gamedata (item_id, name, gamedesc, platform, dev, distributor, genre, players, lang, age, `release`,.......

检查reserved keywords here