Databasing NEEDING HELP!!!

Hay guys im trying to database stuff off the client and into the server not the client so i can setup like a speical team/ clan without worrying about it.
i thought it would be like *PData or NW

Heres my Cl_Init.lua code for the derma:



function clanmm()
local DermaPanel = vgui.Create( "DFrame" )
DermaPanel:SetPos( 50,50 )
DermaPanel:SetSize( 400, 500 )
DermaPanel:SetTitle( "Clan Menu: Making" )
DermaPanel:SetVisible( true )
DermaPanel:SetDraggable( true )
DermaPanel:ShowCloseButton( false )
DermaPanel:MakePopup()
 
local DermaButton = vgui.Create( "DButton" )
DermaButton:SetParent( DermaPanel ) -- Set parent to our "DermaPanel"
DermaButton:SetText( "Close" )
DermaButton:SetPos( 325, 20 )
DermaButton:SetSize( 70, 20 )
DermaButton.DoClick = function ()
DermaPanel:Close()
end

local DermaText = vgui.Create( "DTextEntry", DermaPanel )
DermaText:SetPos( 20,40 )
DermaText:SetTall( 20 )
DermaText:SetWide( 450 )
DermaText:SetEnterAllowed( true )
DermaText.OnEnter = function()
	net.Start( "Make_Clan" )
		net.WriteString( DermaText:GetValue () )
	net.SendToServer()
    DermaPanel:Close()
end
end


Heres my Init.lua with the net.recieve()



net.Receive( "Make_Clan", function( len, ply )
	if ( IsValid( ply ) and ply:IsPlayer() ) then
		ply:SetNWString("clan", net.ReadString())
		
	else
		return false
	end
end )


We’re not gonna code your shit for you though

Well… i know but i could use the advice so i can get a head start and then finish stuff…

Always sanitize data coming from the client; they can delete your entire database if you don’t.

sql.SQLStr( ) wrap input such as names, etc…

When you use ENTITY:GetPData( column, defaultValue ), it’ll select the base table for that player for that column name which should be something like Entity:GetPData( “clan_name”, “N/A” );

To write data to the database you would do ENTITY:SetPData( “clan_name”, userInput );

The good thing about using PData is that it automatically adds the sql.SQLStr for you; no need to escape data.

It’s SQLite. If run on the server it’ll store information in sv.db; if run on the client it’ll store information in cl.db.

When you store data; store it on the server. When you retrieve data, retrieve it on the server and send it to the client.