• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

{help} sql query

gigastar

Member
Joined
Jan 25, 2009
Messages
252
Reaction score
15
Hey everyone, It has been some time sense I have been in the OT community. I was just wondering if someone could tell me how to set up a function to execute a SQL query

I know it is something like this...

function setDatabaseStorage(cid, storage, value)
query = INSERT INTO `accounts` SET `storage` = value WHERE `id` = getPlayerAccountid(cid)
 
Last edited:
Code:
function setDatabaseStorage(cid, value)
   db.executeQuery("UPDATE `accounts` SET `storage` = " .. value .. " WHERE `id` = " .. getPlayerAccountid(cid))
end
 
Just an example, you could use other types as well instead of INT
Code:
ALTER TABLE `tablename` ADD `newcolumn` INT(11) NOT NULL DEFAULT 0;
 
Back
Top