$mysqli->query("CREATE TABLE myCity LIKE City"); $mysqli->query("ALTER TABLE myCity Type=InnoDB"); $mysqli->query("INSERT INTO myCity SELECT * FROM City LIMIT 50");
/* commit insert */ $mysqli->commit();
/* delete all rows */ $mysqli->query("DELETE FROM myCity");
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) { $row = $result->fetch_row(); printf("%d rows in table myCity.\n", $row[0]); /* Free result */ $result->close(); }
/* Rollback */ $mysqli->rollback();
if ($result = $mysqli->query("SELECT COUNT(*) FROM myCity")) { $row = $result->fetch_row(); printf("%d rows in table myCity (after rollback).\n", $row[0]); /* Free result */ $result->close(); }
/* Drop table myCity */ $mysqli->query("DROP TABLE myCity");