title: Sqlite "near" syntax error on iphone
body: <p>I am experimenting a problem with sqlite in my iphone app. Read part is ok, but when I try to write to a database using UPADATE command (I try with INSERT too), the sql sentence give me back the error sqlite3_errmsg:</p>
  
  <pre><code>Failed. Error is:  near "UP": syntax error
  </code></pre>
  
  <p>The code is:</p>
  
  <pre><code>-(void)ratesInfotoDb:(NSString *)idx rate:(NSString*)rate{
  
      query =@"UPDATE rules set rate = 5 where _id = 1994";
  
      sqlite3_stmt *statement;
      sqlite3_prepare_v2(_database, [query UTF8String], SQLITE_OPEN_READWRITE, &amp;statement, nil);
  
      if(sqlite3_step(statement) == SQLITE_DONE ) {
          NSLog(@"element added");
          }
      else{
          NSLog( @"Failed. Error is:  %s", sqlite3_errmsg(_database));
      }
  
      sqlite3_finalize(statement);
      sqlite3_close(_database);
  
  }
  </code></pre>
  
  <p>The query command "UPDATE rules set rate = 5 where _id = 1994" (executed directly on a database), works, so I suppose query is corect.</p>
  
  <p>Could anyone help me please?</p>