query:
$sql .= "INSERT INTO `vip_overrides` SET `user_id` = " . $max . ", `server_id` = " . $user['server_id'] . ", `group` = '" . $user['access'] . "', `expires` = " . $user['utime'] . ", `date_create` = " . $user['time'] . "; ";
answer:
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 'INSERT INTO
vip_overrides
SETuser_id
= 1,server_id
= 2,group
= 'vip',' at line 1
mysqli_query dont work with multy query in one string use mysqli_multi_query
You cannot run multiple queries using mysqli_query.
If it's different queries, then run them separately, one by one.
If it's the same query but with different data, use a prepared statement.
@YourCommonSense is right, you can't run multiple commands in the same call to mysqli_query
. However, you can reorganize your string building to produce just one command.
You have this as your resulting $sql
value:
INSERT INTO foo SET a = 1, b = 2;
INSERT INTO foo SET a = 3, b = 4;
Change your code to make it produce this:
INSERT INTO foo (a, b) VALUES (1, 2), (3, 4);