Nyxynyxx
Nyxynyxx

Reputation: 196

MySQL Error: This command is not supported in the prepared statement protocol yet

I am getting the following error when I use START TRANSACTION and COMMIT to the start and end of my MySQL queries.

SQLSTATE[HY000]: General error: 2030 This command is not supported in the prepared statement protocol yet

SQL: START TRANSACTION

Bindings: array (
)

In Larvel, I did:

DB::query('START TRANSACTION');

I am using the PHP framework Laravel, which uses PDO to access MySQL. What should I do?

Upvotes: 2

Views: 5562

Answers (1)

crynobone
crynobone

Reputation: 1814

Laravel already has a support for transaction query.

DB::transaction(function ()
{
    // query goes here.
    DB::table('foo')->insert(array('foo' => 'bar'));
});

Upvotes: 2

Related Questions