Jump to content

SQL


#Paper

Recommended Posts

I have some problems:

function onResStart () 
executeSQLCreateTable ( "mspserver.point", "serial TEXT, points INT" ) 
end 
addEventHandler("onResourceStart", getResourceRootElement(getThisResource()), onResStart) 
-------------------------------- 
function onJoin () 
local serial = getPlayerSerial(source) 
local getPoints = executeSQLSelect("mspserver.point", "points", "serial='"..serial.."'") 
if getPoints == false then 
executeSQLInsert ( "mspserver.point", "'"..serial.."', '0'" ) 
setElementData(source, "Points", 0) 
else 
setElementData(source, "Points", tonumber(getPoints[1]["point"])) 
end 
end 
addEventHandler("onPlayerJoin", getRootElement(), onJoin) 
---------------------------------------- 
function onPlayerQuit() 
local getActualPoints = getElementData(source, "Points") 
local serial = getPlayerSerial(source) 
executeSQLUpdate ( "mspserver.point", "points = '"..tonumber(getActualPoints).."'","serial = '" ..serial.. "'" ) 
end 
addEventHandler("onPlayerQuit", getRootElement(), onPlayerQuit) 

onJoin and onQuit says: "No such table: mspserver.point"... why?

Link to comment

probably because there's a dot (.) in your table name. which is used in SQL for «parent.child» reference like databaseName.tableName

and since you don't have «mspserver» database, you cant create a table there.

try removing the dot.

Link to comment
probably because there's a dot (.) in your table name. which is used in SQL for «parent.child» reference like databaseName.tableName

and since you don't have «mspserver» database, you cant create a table there.

try removing the dot.

mhh, maybe i will use a MySQL module...

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...