[英]what is the correct syntax for MySQL alter table query?
While I try to run the following mysqli call 当我尝试运行以下mysqli调用时
$strSQL3=mysqli_query($connection," alter table mark_list add column 'mark' int(2) " ) or die(mysqli_error($connection));
returns 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 `mark int(2)` at line 1
Single quotes ( '
) denote string literals. 单引号( '
)表示字符串文字。 Object names (such as columns), are not strings - juts lose the quotes: 对象名称(例如列)不是字符串-突出号将引起引号:
$strSQL3 = mysqli_query($connection ,"alter table mark_list add column mark int(2)" ) or die(mysqli_error($connection));
Try changing 'mark' to mark like this: 尝试更改“标记”以这样标记 :
$strSQL3=mysqli_query($connection,
" alter table mark_list add column mark int(2) " )
or die(mysqli_error($connection));
只需删除'
标记附近的引号
$strSQL3=mysqli_query($connection," alter table mark_list add column mark int(2) " ) or die(mysqli_error($connection));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.