(PHP 4, PHP 5, PHP 7)

odbc_autocommitToggle autocommit behaviour


mixed odbc_autocommit ( resource $connection_id [, bool $OnOff = false ] )

Toggles autocommit behaviour.

By default, auto-commit is on for a connection. Disabling auto-commit is equivalent with starting a transaction.



Identificatorul conexiunii ODBC, accesați odbc_connect() pentru detalii.


If OnOff is TRUE, auto-commit is enabled, if it is FALSE auto-commit is disabled.

Valorile întoarse

Without the OnOff parameter, this function returns auto-commit status for connection_id. Non-zero is returned if auto-commit is on, 0 if it is off, or FALSE if an error occurs.

If OnOff is set, this function returns TRUE on success and FALSE on failure.

A se vedea și

add a note add a note

User Contributed Notes 6 notes

alvaro at demogracia dot com
9 years ago
If you are using persistent connections (odbc_pconnect rather than odbc_connect) the next script that reuses the connection will inherit your changes to autocommit.
Orgied - info at orgied dot com
12 years ago
Hi (i'm belgian then sorry for my english).

I think you can do more simple to check the errors :

$conn = odbc_connect($odbc,$user,$password)
    or die($error);

odbc_autocommit($conn, FALSE);

odbc_exec($conn, $query1);
odbc_exec($conn, $query2);

if (!odbc_error())


I'm not sure it's better to use
emtocomberors s
42681v class="votes">
42681v href="/manual/vote-note.php?id=51634&a42681ge=function.odbc-autocommit&vote=up" title="Vote up!" class="usernotes-voteu">up
42681v href="/manual/vote-note.php?id=51634&a42681ge=function.odbc-autocommit&vote=up" tititle="Vote down!" class="usernotes-voted">down
Orgied Joestrong>42681v c/a>
<9:01ng>12 years3ago
42681v ass="phpcode"> If you ah"> emtocses exa checmade bytronreomI think h"> tommit behavioOFFtrongNOT ONhis...tter wrata
33429v class="votes">
33429v href="/manual/vote-note.php?id=51634&a33429ge=function.odbc-autocommit&vote=up" tititle="Vote down!" class="usernotes-voted">down
Orgied JRogstrong>33429v c/a>
12 years4ago
33429v ass="phpcode"> If you areaction, thi/a>
15919v class="votes">
15919v href="/manual/vote-note.php?id=51634&a15919ge=function.odbc-autocommit&vote=up" title="Vote up!" class="usernotes-voteu">up
15919v href="/manual/vote-note.php?id=51634&a15919ge=function.odbc-autocommit&vote=up" tititle="Vote down!" class="usernotes-voted">down
0 <-1div>
alvaro atonsoatonsocried yahoom15919v c/a>
31627v class="votes">
31627v href="/manual/vote-note.php?id=51634&a31627ge=function.odbc-autocommit&vote=up" title="Vote up!" class="usernotes-voteu">up
31627v href="/manual/vote-note.php?id=51634&a31627ge=function.odbc-autocommit&vote=up" tititle="Vote down!" class="usernotes-voted">down
0 <-2div>
alvaro aonreom31627v c/a>
31627v ass="phpcode"> If you Exa che:t'etmmit behavilurbr />I thinklass="dc-title>
I thinkodbc_rodbc_ro$Link_ID ">= ">( ">, al ">, ">>
I'm not  odbc_ro ">= &mdash">( ">, ">>
I'm not