Question: What I'd like to do is to update two rows with the same query. What I have is this:

```
 $sqlUpdate = "UPDATE user.user SET level='2' WHERE id='".$_GET['char']."' AND level >0 AND item>0 LIMIT 1   ";

```

My idea is to do something like this :

```
 $sqlUpdate = "UPDATE user.user SET level='2' && SET power='1' WHERE id='".$_GET['char']."' AND level >0 AND item>0 LIMIT 1   ";

```

In my opinion that looks logical but it does not work, any idea of how to do this? Thanks!

Answer: 
Do you mean update 2 columns? That is what your second query is trying to do. Try this:

```
$sqlUpdate = "UPDATE user.user SET level='2', power='1' WHERE id='".$_GET['char']."' AND level >0 AND item>0 LIMIT 1   ";

```
For updating more than one field in an update query:

You separate the fields/values by a comma.

```
$sql = "UPDATE user.user SET level='2', power='1' WHERE id='" . $_GET['char'] . "' AND level > 0 AND item > 0 LIMIT 1;";

```

**Note: The above query is vulnerable to [SQL Injection](http://en.wikipedia.org/wiki/SQL_injection) because anything can be passed to the $\_GET variable by the user. This can be used maliciously to alter your query.**

For updating more than one row in an update query:

Only the same data can be placed in multiple rows. You modify the where statement to logically include the rows that should be updated. If the data is to be different per row then this is not possible, but you can use [prepared statements](http://php.net/manual/en/pdo.prepared-statements.php). 

Prepared statements allow you to set up a template for a query that will be run many times. Then you can just pass the values. Most databases will cache the query so that there is a performance boost. It also protects against SQL injection by separating the query from the data.