mysql错误但在mysql工作台上运行正常

MySQL Query works fine using MySQL workbench but produces an error when I am executing it through PHP.

$sql = "INSERT INTO authors (submission_id, first_name, last_name, email, affiliation, country)
VALUES ('83', 'Chris', 'Hobbit', 'asfasf@gmail.com','Maryland', 'PK');

UPDATE articles
SET title='83',
abstract = 'Comp'
where article_id = '83'; 
"; 

$result = Model::getConnection()->query($sql) or die(mysqli_error(Model::getConnection()));

This is the error I get from PHP.

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 articles SET title='83', abstract = 'Comp' where article_id = '8' at line 1

Yet this same SQL script works fine on MySQL workbench. Whats the problem?

You cannot execute multiple queries with mysql_query. Split your query into two (and get rid of the semicolons I think) and call mysql_query twice

Put your sql statement on two variables

 $query = "INSERT INTO authors (submission_id, first_name, last_name, email, affiliation, country)
 VALUES ('83', 'Chris', 'Hobbit', 'asfasf@gmail.com','Maryland', 'PK')";

 $query1 = "UPDATE articles SET title='83', abstract = 'Comp' where article_id = '83'"; 

Then execute your queries:

 $result = Model::getConnection()->query($query) or die(mysqli_error(Model::getConnection()));
 $result = Model::getConnection()->query($query1) or die(mysqli_error(Model::getConnection()));