Statement: alter table tableName engine = InnoDB;
Tables Used
Copy codeThe Code is as follows: create table if not exists 'test '(
'Id' int (10) not null auto_increment,
'Websitename' varchar (200) character set utf8 not null,
'Websiteurl' varchar (200) character set utf8 not null,
Primary key ('id ')
) ENGINE = InnoDB default charset = utf8 AUTO_INCREMENT = 1;
The second is not to add things:Copy codeThe Code is as follows: <? Php
$ Con = mysql_connect ("localhost", "root", "vertrigo ");
// Start the transaction
Mysql_db_query ("mysqlnew", "BEGIN ");
$ InsertSql = "insert into test (websitename, websiteurl) values ('feet home', 'HTTP: // www.jb51.net ')"; // insert this record into the database
Mysql_db_query ("mysqlnew", $ insertSql );
$ InsertSql = "insert into test (websitename, websiteurl) values ('Baidu ', 'HTTP: // www.baidu.com')"; // insert this record into the database
Mysql_db_query ("mysqlnew", $ insertSql );
// End the transaction
Mysql_db_query ("mysqlnew", "COMMIT ");
// Start the transaction
Mysql_db_query ("mysqlnew", "BEGIN ");
$ InsertSql = "insert into test (websitename, websiteurl) values ('Google ', 'HTTP: // www.google.com.hk')"; // This record is not inserted into the database
Mysql_db_query ("mysqlnew", $ insertSql );
// End the transaction
Mysql_db_query ("mysqlnew", "ROLLBACK ");
// Start the transaction
Mysql_db_query ("mysqlnew", "BEGIN ");
$ InsertSql = "insert into test (websitename, websiteurl) values ('bing ', 'HTTP: // www.bing.com')"; // This record is not inserted into the database
Mysql_db_query ("mysqlnew", $ insertSql );
?>
Inserted data
Id websitename websiteurl
1 foot home http://www.jb51.net
2 Baidu Co., http://www.baidu.com.