Esempio 2. Procedural style
<?php $link = mysqli_connect("localhost", "my_user", "my_password", "test");
/* check connection */ if (!$link) { printf("Connect failed: %s\n", mysqli_connect_error()); exit(); }
/* set autocommit to off */ mysqli_autocommit($link, FALSE);
mysqli_query($link, "CREATE TABLE Language LIKE CountryLanguage Type=InnoDB");
/* Insert some values */ mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Bavarian', 'F', 11.2)"); mysqli_query($link, "INSERT INTO Language VALUES ('DEU', 'Swabian', 'F', 9.4)");
/* commit transaction */ mysqli_commit($link);
/* close connection */ mysqli_close($link); ?>
|
|