This repository has been archived by the owner on May 13, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Common errors
Reece Harris edited this page Jul 10, 2021
·
3 revisions
When coding your SQL you will get to the point you need to concatenate variables inside your SQL code, there are some common errors that happen.
SQL needs parentheses around values Not column names but the values going into the column for example say I want to add some gold to someones account I would do this
local payload = "UPDATE userData SET gold ='"..goldValue.."' WHERE userId = '"..player.UserId.."';"
local response = DataStore3.PostPayload(url, apiKey, username, payload)
✔️
gold ='"..goldValue.."' # See how I put ' before " and after the concatenate I put ' after "
# for example say goldValue was 10 when you send the request to the server the SQL execute will now see this...
UPDATE userData SET gold ='10' WHERE userId = '2685277144';
❌
gold ="..goldValue.." # But if I didn't add ' before " and add ' after " the SQL would see this and through an error
UPDATE userData SET gold = 10 WHERE userId = 2685277144;