Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You need to use the <a href="http://php.net/manual/en/book.mysqli.php" rel="noreferrer">mysqli extension</a> to use this functionality.</p> <p>See: <a href="http://www.php.net/manual/en/mysqli.autocommit.php" rel="noreferrer">autocommit()</a>, <a href="http://www.php.net/manual/en/mysqli.commit.php" rel="noreferrer">commit()</a>, and <a href="http://www.php.net/manual/en/mysqli.rollback.php" rel="noreferrer">rollback()</a></p> <pre><code>&lt;?php $link = mysqli_connect("localhost", "my_user", "my_password", "world"); /* check connection */ if (mysqli_connect_errno()) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); } /* disable autocommit */ mysqli_autocommit($link, FALSE); mysqli_query($link, "CREATE TABLE myCity LIKE City"); mysqli_query($link, "ALTER TABLE myCity Type=InnoDB"); mysqli_query($link, "INSERT INTO myCity SELECT * FROM City LIMIT 50"); /* commit insert */ mysqli_commit($link); /* delete all rows */ mysqli_query($link, "DELETE FROM myCity"); if ($result = mysqli_query($link, "SELECT COUNT(*) FROM myCity")) { $row = mysqli_fetch_row($result); printf("%d rows in table myCity.\n", $row[0]); /* Free result */ mysqli_free_result($result); } /* Rollback */ mysqli_rollback($link); if ($result = mysqli_query($link, "SELECT COUNT(*) FROM myCity")) { $row = mysqli_fetch_row($result); printf("%d rows in table myCity (after rollback).\n", $row[0]); /* Free result */ mysqli_free_result($result); } /* Drop table myCity */ mysqli_query($link, "DROP TABLE myCity"); mysqli_close($link); ?&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload