MySQL User ID handling doesen't work

I have this to check for any user id’s:

local query = “SELECT * FROM tb_users WHERE STEAMID = '” … ply:SteamID() … “’”;

local tab, succ, err = mysql.query( TS.SQL, query );

if( tab and #tab > 0 ) then 

	ply:SetField( "uid", tab[1][1] );


However, it doesen’t work. It stops at the tab checking part. I’ve tried if( tab ) then which seems to go on, but then it doesen’t work properly later on.

I’m sure all of the mySQL tables/rows are setup correctly, but I have no idea why it’s doing it as I’m not really experienced with MySQL.

Help appreciated.

Put [lua]print( "MySQL Error? - " … err )[/lua] after the query. See what it returns. Post it here, if you still can’t figure it out.