You appear to have an extra comma at the end:
INSERT INTO email_table VALUES ('$CAMPAIGN', '$IP',)
Try:
INSERT INTO email_table VALUES ('$CAMPAIGN', '$IP')
BTW, I won’t judge your code too much but tracking people by IP is not very reliable. For example, a lot of corporate traffic behind company firewalls can use the same IP address.
Also, it looks like $CAMPAIGN
comes from the HTTP post, which can be a security issue if you’re not parameterizing your SQL.
5
solved Cant locate SQL syntax error in basic email tracking pixel [closed]