title: Update statement in sqlite
body: <p>Hey what i want to do is update a table if the field exsits or insert the new value as given by the user.</p>
  
  <p>For this what i do is select everything present in the table and check if the name entered by the user exists den update it or else insert it. </p>
  
  <p>However the problem is when there is no data in the table the query fails and no data is inserted in the table.</p>
  
  <pre><code>NSString *query = @"select * from PPM";
  sqlite_stmt *statement;
  
  if(sqlite_prepare_v2(database,[query UTF8string],-1,&amp;statement,NULL) == SQLITE_OK)
  {
      while (sqlite3_step(statement) == SQLITE_ROW)
       //select data from table  
       //if value entered is same as entered by user update the table
       //else insert in the table
  }
  </code></pre>