Reputation: 57
While I try to run the following mysqli call
$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
Upvotes: 2
Views: 254
Reputation: 4637
Simply you need to remove the quotes near '
mark
$strSQL3=mysqli_query($connection," alter table mark_list add column mark int(2) " ) or die(mysqli_error($connection));
Upvotes: 1
Reputation: 10665
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));
Upvotes: 2
Reputation: 311163
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));
Upvotes: 2