MySQL Error

?:?: unexpected symbol near ’ ’
Its the only error it through out

What does this mean?



require( "mysql" )

local ConnectionData = {
	IP = "h",
	User = "h",
	Pass = "h",
	DB = "h"
}

module( "db", package.seeall )

local plmeta = FindMetaTable( "Player" )

function Query( q )
	print( "Preparing to perform query..." )
	local dat = ConnectionData
	print( "About to connect... ")
	local db, err = mysql.connect( dat.IP, dat.User, dat.Pass, dat.DB )
	print( "DB ID:", db )
	print( "Err:", err )
	if ((!db) || (db == 0)) then
		print( "Failed to connect to SQL database! ", err )
		return false, "connect", err
	end
	local val, isok, err = mysql.query( db, q )
	if (!isok) then
		print( "Failed to query SQL database! " .. err )
		return false, "query", err
	end
	local b, err = mysql.disconnect( db )
	if (!b) then
		print( "Failed to disconnect from SQL database! " .. err )
		return false, "disconnect", err
	end
	return true, "success", val
end

function GetPlayerRow( ply )
	local id = ply:SteamID()
	local b, stat, res = Query( "SELECT * FROM s WHERE SteamID='" .. id .. "';" )
	if (!b) then return end
	if (!res) then return end
	return res[1]
end

function CreateAccount( ply, username, password )
	local p = util.CRC( password )
	local q = "INSERT INTO s (SteamID, Username, Password) VALUES ('" .. ply:SteamID() .. "','" .. username .. "'," .. p .. ");"
	local b, stat, res = Query( q )
	return b, res
end

function SaveInfo( ply, key, val )
	if (!ply.Data) then ply.Data = {} end
	local dat = ply.Data
	dat[ key ] = val
	local q = "UPDATE s SET " .. key .. "=" .. tostring( val ) .. " WHERE (SteamID='" .. ply:SteamID() .. "');"
	local b, stat, res = Query( q )
	return b, res
end

function plmeta:GetDBRow()
	return GetPlayerRow( self )
end


You could, you know… Show us the code, so it’s a tiny bit easier to check where’s the error. :slight_smile:

Edited OP

may help if you give us full error

Err… I’d only say that “?:?: unexpected symbol near ’ '” perfectly describes the line where it failed. Plus you should put a comment on the line it failed, we can’t read the full error with source included from here, unless someone has a telepathic mind. :downs:

?:?: unexpected symbol near ’ ’ - 'Tis the full error.

Take a picture of it, please?

Clearly you don’t know how to get errors do a console dump and post your hole console I will find the error for you

Fish and GranPC, your help is really important to us, but Matt and I have had a bad past with you two. So I’d recommend you stop Flaming/Trolling the thread and contribute.
The error is nothing but


?:?: unexpected symbol near ' '

as Matt said.

We are not trolling. But whatever.
Also, the error is quite strange. I’d suggest start commenting out lines until you find the one that causes the error, and then post here on what line it was.

or using print functions to see what gets ran

Fish, Sounds like an error when its compiled. Doubt anything in that file gets ran.