title: SQLite syntax error: while compiling: UPDATE contacts SET name=? WHERE phone=+34
body: <p>In my project, there's a piece of code that is waiting to be called by <code>ContentObserver</code> when there's a change on the contact table. When it happens, I check every contact in the table one by one if had been changed or if one has been created. Then, depending on this, I save my changes on my own table. But it gives me errors. Here's my code:</p>
  <pre><code>while (phones.moveToNext()) {
              try {
                  name = phones
                          .getString(phones
                                  .getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME));
                  phoneNumber = phones
                          .getString(phones
                                  .getColumnIndex(ContactsContract.CommonDataKinds.Phone.NUMBER));
  
                  JSONObject jobject = db.select_contact(name, phoneNumber);
  
                  String type1 = jobject.getString(&quot;type&quot;);
  
                  if (type1.equals(&quot;upload&quot;)) {
                      Log.i(&quot;********&quot;, &quot;Upload on the db&quot; + name + &quot;  &quot;
                              + phoneNumber);
                      db.contact_table(name, phoneNumber);
                  } else if (type1.equals(&quot;change_name&quot;)) {
                      db.update_name(name, phoneNumber);
                      Log.i(&quot;********&quot;, &quot;Change name and upload &quot; + name);
                  } else if (type1.equals(&quot;change_phone&quot;)) {
                      db.update_name(name, phoneNumber);
                      Log.i(&quot;********&quot;, &quot;Change phone and upload &quot;
                              + phoneNumber);
                  }
  
              } catch (Exception ex) {
                  ex.printStackTrace();
              }
          }
  </code></pre>
  <p>And there's the part where i upload it to my own table created by me:</p>
  <pre><code>public long update_name(String name, String number) {
      ContentValues cv = new ContentValues();
      cv.put(NAME, name);
      return ourDatabase.update(DATABASE_TABLE_4, cv, NUMBER + &quot;=&quot; + number,
              null);
  }
  
  public long update_number(String name, String number) {
      ContentValues cv = new ContentValues();
      cv.put(NUMBER, number);
      return ourDatabase
              .update(DATABASE_TABLE_4, cv, NAME + &quot;=&quot; + name, null);
  }
  </code></pre>
  <p>The problem is that on the part of upload changes on the DB, it gives me this errors:</p>
  <pre><code>07-07 09:28:41.412: W/System.err(11667): android.database.sqlite.SQLiteException: near &quot;629&quot;: syntax error: , while compiling: UPDATE contacts SET name=? WHERE phone=+34 629 21 00 80
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteCompiledSql.native_compile(Native Method)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteCompiledSql.&lt;init&gt;(SQLiteCompiledSql.java:68)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteProgram.compileSql(SQLiteProgram.java:143)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteProgram.compileAndbindAllArgs(SQLiteProgram.java:361)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteStatement.acquireAndLock(SQLiteStatement.java:260)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteStatement.executeUpdateDelete(SQLiteStatement.java:84)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteDatabase.updateWithOnConflict(SQLiteDatabase.java:1936)
  07-07 09:28:41.412: W/System.err(11667):    at android.database.sqlite.SQLiteDatabase.update(SQLiteDatabase.java:1887)
  07-07 09:28:41.412: W/System.err(11667):    at com.background.Database.update_name(Database.java:215)
  07-07 09:28:41.417: W/System.err(11667):    at com.extract.Contacts.onChange(Contacts.java:69)
  07-07 09:28:41.417: W/System.err(11667):    at android.database.ContentObserver$NotificationRunnable.run(ContentObserver.java:43)
  07-07 09:28:41.417: W/System.err(11667):    at android.os.Handler.handleCallback(Handler.java:605)
  07-07 09:28:41.417: W/System.err(11667):    at android.os.Handler.dispatchMessage(Handler.java:92)
  07-07 09:28:41.417: W/System.err(11667):    at android.os.Looper.loop(Looper.java:137)
  07-07 09:28:41.417: W/System.err(11667):    at android.app.ActivityThread.main(ActivityThread.java:4507)
  07-07 09:28:41.422: W/System.err(11667):    at java.lang.reflect.Method.invokeNative(Native Method)
  07-07 09:28:41.422: W/System.err(11667):    at java.lang.reflect.Method.invoke(Method.java:511)
  07-07 09:28:41.422: W/System.err(11667):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:790)
  07-07 09:28:41.422: W/System.err(11667):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:557)
  07-07 09:28:41.422: W/System.err(11667):    at dalvik.system.NativeStart.main(Native Method)
  </code></pre>