Im trying to update a specific user's information in SQL database when a user Login and I dont know why do I get this error. Please help :(

I check the record first. If there is none, I will add the user, and if it exist in my SQL. Not sure if im getting this correct.

```
 public String RecordCheck(){
    FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
    FirebaseUser user = firebaseAuth.getCurrentUser();
    userEmail = user.getEmail().toString();

    String RecordHolder = "";
    SQLiteDatabase db = getWritableDatabase();
    String query = "" + "SELECT * FROM " + TABLE_USERINFO + " WHERE " + COLUMN_USEREMAIL + " = '" + userEmail.trim() + "'";
    //Cursor point to a location in your results
    Cursor c = db.rawQuery(query, null);

    if(c.equals("")){
        RecordHolder = "adduser";
    }
    else
        RecordHolder = "updateuser";

    db.close();
    return RecordHolder;

```

I have this in my Welcome Back class to know if its going to update if user exist or add if user doesnt exist.

```
String Record = dbHandler.RecordCheck();

            if(Record.equals("adduser")){
                dbHandler.addUser(userdata);
            }
            else {
                dbHandler.updateUser(userdata);
            }

```

if update is called

```
public void updateUser(Users user){
    FirebaseAuth firebaseAuth = FirebaseAuth.getInstance();
    FirebaseUser userf = firebaseAuth.getCurrentUser();
    userEmail = userf.getEmail();

    ContentValues values = new ContentValues();
    values.put(MyDBHandler.COLUMN_USEREMAIL, user.get_useremail());
    values.put(MyDBHandler.COLUMN_NAME, user.getName());
    values.put(MyDBHandler.COLUMN_SEX, user.getSex());
    values.put(MyDBHandler.COLUMN_BDAY, user.getBday());
    values.put(MyDBHandler.COLUMN_HEIGHT, user.getHeight());
    values.put(MyDBHandler.COLUMN_MHEIGHT, user.getMheight());
    values.put(MyDBHandler.COLUMN_WEIGHT, user.getWeight());
    values.put(MyDBHandler.COLUMN_MWEIGHT, user.getMweight());
    values.put(MyDBHandler.COLUMN_USEREXPERIENCE, user.getUserexperience());
    values.put(MyDBHandler.COLUMN_FQUESTION, user.getFquestion());
    values.put(MyDBHandler.COLUMN_SQUESTION, user.getSquestion());
    values.put(MyDBHandler.COLUMN_TQUESTION, user.getTquestion());
    values.put(MyDBHandler.COLUMN_BODYSTATE, user.getBodystate());
    values.put(MyDBHandler.COLUMN_APPARENTLYHEALTHY, user.isApparentlyhealthy());
    values.put(MyDBHandler.COLUMN_HYPERTENSION, user.isHypertension());
    values.put(MyDBHandler.COLUMN_DIABETES, user.isDiabetes());
    values.put(MyDBHandler.COLUMN_ASTHMA, user.isAsthma());

    SQLiteDatabase db = getWritableDatabase();
    db.update(MyDBHandler.TABLE_USERINFO, values, userEmail, null);
    db.close();
}

```

> 
> --------- beginning of crash
> 
> 
> 

```
11-22 12:44:13.179 17496-17496/com.example.abad.maxfitness2 E/AndroidRuntime: FATAL EXCEPTION: main
                                                                              Process: com.example.abad.maxfitness2, PID: 17496
                                                                              android.database.sqlite.SQLiteException: near "@gmail": syntax error (code 1): , while compiling: UPDATE users SET fquestion=?,mheight=?,tquestion=?,asthma=?,height=?,bodystate=?,diabetes=?,weight=?,bday=?,useremail=?,squestion=?,hypertension=?,name=?,healthy=?,mweight=?,userexp=?,sex=? WHERE testing8@gmail.com
                                                                                  at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method)
                                                                                  at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:889)
                                                                                  at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:500)
                                                                                  at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:588)
                                                                                  at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:58)
                                                                                  at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:31)
                                                                                  at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1577)
                                                                                  at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1525)
                                                                                  at com.example.abad.maxfitness2.LocalDatabase.MyDBHandler.updateUser(MyDBHandler.java:139)
                                                                                  at com.example.abad.maxfitness2.WelcomeBack$1.onDataChange(WelcomeBack.java:83)
                                                                                  at com.google.android.gms.internal.zzbmz.zza(Unknown Source)
                                                                                  at com.google.android.gms.internal.zzbnz.zzYj(Unknown Source)
                                                                                  at com.google.android.gms.internal.zzboc$1.run(Unknown Source)
                                                                                  at android.os.Handler.handleCallback(Handler.java:751)
                                                                                  at android.os.Handler.dispatchMessage(Handler.java:95)
                                                                                  at android.os.Looper.loop(Looper.java:154)
                                                                                  at android.app.ActivityThread.main(ActivityThread.java:6119)
                                                                                  at java.lang.reflect.Method.invoke(Native Method)
                                                                                  at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
                                                                                  at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)

```