I apologize in advance for the terrible coding.
So when i go to retrieve data from table donator_data i can't get anything out. I don't know where else to turn to but the bunch of geniuses you are.
I have a bunch of commands in here that i was using to debug so just disregard those. sql.LastError() returns no such column: nil on all the queries in data retrieval.
Please Help my stupidity.
Data Entry:
[Lua]
function saveText( ply, donatortext )
steamID = ply:GetNWString("SteamID")
print(donatortext)
sql.Query("UPDATE donator_info SET donatortext = "..donatortext.." WHERE unique_id = '"..steamID.."'")
ply:ChatPrint("Text Changed!")
end
function saveColor( ply, textcolor )
steamID = ply:GetNWString("SteamID")
PrintTable(textcolor)
red = textcolor[r]
green = textcolor[g]
blue = textcolor[b]
alpha = textcolor[a]
sql.Query("UPDATE donator_info SET red = "..tostring(red)..", green = "..tostring(green)..", blue = "..tostring(blue)..", alpha = "..tostring(alpha).." WHERE unique_id = '"..steamID.."'")
ply:ChatPrint("Color Changed!")
end
[/Lua]
New Player:
[Lua]
function new_player( SteamID, ply )
steamID = SteamID
sql.Query( "INSERT INTO donator_info (`unique_id`, `donatortext`, `red`, `green`, `blue`, `alpha`)VALUES ('"..steamID.."', '(VIP)', '233', '0', '255', '255')" )
result = sql.Query( "SELECT unique_id, donatortext, red, green, blue, alpha FROM donator_info WHERE unique_id = '"..steamID.."'" )
if (result) then
else
Msg("Something went wrong with creating a donator info !\n")
end
end
[/Lua]
Table Creation:
[Lua]
function tables_exist()
if (sql.TableExists("donator_info")) then
Msg("Table already exists !")
else
if (!sql.TableExists("donator_info")) then
query = "CREATE TABLE donator_info ( unique_id varchar(255), red varchar(255), green varchar(255), blue varchar(255), alpha varchar(255) )"
result = sql.Query(query)
if (sql.TableExists("donator_info")) then
Msg("Succes ! table 1 created \n")
else
Msg("Somthing went wrong with the donator_info query ! \n")
Msg( sql.LastError( result ) .. "\n" )
end
end
end
end
[/Lua]
Retrieval:
[Lua] elseif pl:GetUserGroup() == "vip" then
unique_id = pl:SteamID()
donatortext = sql.Query("SELECT donatortext FROM donator_info WHERE unique_id = '"..unique_id.."'")
print(sql.LastError())
red = sql.Query("SELECT red FROM donator_info WHERE unique_id = '"..unique_id.."'")
print(sql.LastError())
green = sql.Query("SELECT green FROM donator_info WHERE unique_id = '"..unique_id.."'")
print(sql.LastError())
blue = sql.Query("SELECT blue FROM donator_info WHERE unique_id = '"..unique_id.."'")
print(sql.LastError())
alpha = sql.Query("SELECT alpha FROM donator_info WHERE unique_id = '"..unique_id.."'")
print(sql.LastError())
print(donatortext)
print(red)
print(green)
print(blue)
print(alpha)
table.insert( tab, Color( red, green, blue, alpha ) )
table.insert( tab, donatortext )
[/Lua]
[lua] query = "CREATE TABLE donator_info ( unique_id varchar(255), red varchar(255), green varchar(255), blue varchar(255), alpha varchar(255) )"[/lua]
In table creation, donatortext is never specified.
R,G,B,A is a varchar with a max size of 255.
No worries I'm even more stupid then u would imagine...
Sorry, you need to Log In to post a reply to this thread.