require "sqlite3" db = sqlite3.open( system.pathForFile( "database.sqlite", system.ResourceDirectory ) ) db:exec( "CREATE TABLE IF NOT EXISTS db( id INTEGER PRIMARY KEY, name String, audio STRING, score INT )" ) function newSQLData() if not( getSQLData( "user" ) ) then db:exec( "INSERT INTO db( name, audio, score ) VALUES( 'user', 'on', '0' )" ) end end function setSQLData( row, value ) if ( getSQLData( "user" ) ) then db:exec( "UPDATE db SET '"..row.."' ='"..value.."', WHERE name = 'user'" ) end end function getSQLData( row ) if ( getSQLData( "user" ) ) then local value = db:exec( "SELECT '"..row.."' FROM db WHERE name = 'user'" ) return value end end
This crap doesn’t work. I don’t know whats wrong…
It should check if someones already registeres and if not insert the data…