Maurize Posted April 9, 2014 Share Posted April 9, 2014 If I call newSQLData() it prints both options to console and insert. So it ignores the check if the user is already in database? What is wrong... ? EDIT: If table isn't present, it doesn't create it at first time. But if I restart the project, table gets created... [code=text]function setSQLData( row, value ) db:exec( "UPDATE db SET '"..row.."' ='"..value.."', WHERE name = 'user'" ) end function getSQLData( row ) local value = db:exec( "SELECT '"..row.."' FROM db WHERE name = 'user'" ) if ( value ) then return value else return false end end function newSQLData() if ( getSQLData( "name" ) ~= "user" ) then db:exec( "INSERT INTO db( name, audio, score ) VALUES( 'user', 'on', '0' )" ) print( "newSQLData() called INSERT" ) else return false end print( "newSQLData() called FALSE" ) end [/code] Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now