explain differences between two different updates

To sum it up:

The first approach (parameterized query/prepared statement) is best, because it

  1. is easy: automagical quoting and formatting of the parameters
  2. can be more efficient: the DBMS may optimize
  3. avoids fetching and storing the resultset (@Ansgar)
  4. scales better: would work for many records without change
  5. guards against SQL-Injection

The second approach is worse because not having features 1 - 5 and worst/naive because not checking for an empty recordset (@peter, @Cageman).