I have a function that inserts data into a SQLite database. I can manually add data using
sqlStatement.text = "INSERT INTO users (First_Name, Last_Name) VALUES ('John', 'Doe')";
This works perfectly. Now I am trying to insert the data from a variable instead. I can trace my variable from this function- trace(Main._firstName); //returns John, but when I insert it using this:
sqlStatement.text = "INSERT INTO users (First_Name, Last_Name) VALUES (" + Main._firstName + ", 'Doe')";
it inserts it as “null Doe”. Please help, thanks!
Try this one: