#Paper Posted July 20, 2011 Share Posted July 20, 2011 So, i made this table: executeSQLCreateTable("lolers", "serial TEXT, lollingtime INT") then i have to add the field "lollername": how can i do it whitout drop the table and remake it? Link to comment
BinSlayer1 Posted July 20, 2011 Share Posted July 20, 2011 read here http://www.w3schools.com/sql/sql_alter.asp (I suggest using RunCode for this) Link to comment
#Paper Posted July 20, 2011 Author Share Posted July 20, 2011 I tryed another way to do it: make another table for each data: function loadPlayerData (player,datatype, num) if (player) and (datatype) and (num) then local serial = getPlayerSerial(player) local findQuery = executeSQLSelect ( datatype, datatype, "serial = '" .. serial .. "'" ) if ( type( findQuery ) == "table" and #findQuery == 0 ) or not findQuery then if num == true then executeSQLCreateTable(datatype, datatype.." INT, serial TEXT") executeSQLInsert ( datatype, "'0', '"..serial.."'") elseif num == false or not num then executeSQLCreateTable(datatype, datatype.." TEXT, serial TEXT") executeSQLInsert ( datatype, "'N/A', '"..serial.."'") end else return findQuery[1][tostring(datatype)] end end end -- Save data to the database function savePlayerData (player,datatype,newvalue) if (player) and (datatype) and (newvalue) then local serial = getPlayerSerial(player) local findQuery = executeSQLSelect ( datatype, datatype, "serial = '" .. serial .. "'" ) if ( type( findQuery ) == "table" and #findQuery == 0 ) or not findQuery then if num == true then executeSQLCreateTable(datatype, datatype.." INT, serial TEXT") executeSQLInsert ( datatype, "'0', '"..serial.."'") elseif num == false or not num then executeSQLCreateTable(datatype, datatype.." TEXT, serial TEXT") executeSQLInsert ( datatype, "'N/A', '"..serial.."'") end else executeSQLUpdate ( datatype, datatype.." = '"..newvalue.."'","serial = '" .. serial .. "'" ) end end end but doesn't work: First doing this, for be more sure, i putted the default registry.db and internal.db, and doesn't work can u fix? pls? Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now