PHP准备语句错误

时间:2015-09-26 18:53:37

标签: php mysql

我一直在努力学习在PHP中使用预处理语句。我无法弄清楚为什么我的准备每次都失败了。我有一个小桌子,有三列。该表格为 var dst = [this.topLeft, this.topRight, this.bottomLeft, this.bottomRight, this.topCenter, this.bottomCenter];/*i add this*/ var arr = [0, 1, 2, 3, 4, 5, 6, 7]; for(var i = 0; i < 4; i++) { aM[i][0] = aM[i+4][3] = i & 1 ? width + offsetX : offsetX; aM[i][1] = aM[i+4][4] = (i > 1 ? height + offsetY : offsetY); aM[i][6] = (i & 1 ? -offsetX-width : -offsetX) * (dst[i].x + offsetX); aM[i][7] = (i > 1 ? -offsetY-height : -offsetY) * (dst[i].x + offsetX); aM[i+4][6] = (i & 1 ? -offsetX-width : -offsetX) * (dst[i].y + offsetY); aM[i+4][7] = (i > 1 ? -offsetY-height : -offsetY) * (dst[i].y + offsetY); bM[i] = (dst[i].x + offsetX); bM[i + 4] = (dst[i].y + offsetY); aM[i][2] = aM[i+4][5] = 1; aM[i][3] = aM[i][4] = aM[i][5] = aM[i+4][0] = aM[i+4][1] = aM[i+4][2] = 0; } 。 列是

Test

A_ID, FirstName, LastName
A_ID id an auto increment

1 个答案:

答案 0 :(得分:0)

这里有一个语法错误,其中包含不相关的;

if (!($stmt = $connection -> prepare("INSERT INTO Test (FirstName, LastName) 
                                   VALUES (?,?)"))); { //rest of the code

应该是这样的:

if (!($stmt = $connection -> prepare("INSERT INTO Test (FirstName, LastName) 
                                   VALUES (?,?)"))) { //rest of the code