I made php script that updates database:

```
<?php
include 'config.php';

$PauseID = "2";
$ProductionID = "1411979966";

$sql = "SET @max = (SELECT MAX(Id) FROM tblproductionbreaks); UPDATE tblproductionbreaks SET IDPause = '$PauseID' WHERE ProductionID = '$ProductionID' AND Id = @max;";     

mysql_query($sql) or die(mysql_error());

mysql_close($connect);

?>

```

While executing this script it returns error:

> 
> You have an error in your SQL syntax; check the manual that
>  corresponds to your MySQL server version for the right syntax to use
>  near 'UPDATE tblproductionbreaks SET IDPause = '2' WHERE ProductionID
>  = '1411979966' A' at line 1
> 
> 
> 

But if I try same update query execute by command line it works

```
SET @max = (SELECT MAX(Id) FROM tblproductionbreaks); UPDATE tblproductionbreaks SET IDPause = '2' WHERE ProductionID = '1411979966' AND Id = @max;

```

I don't understand how the same thing works differently.