The statement is as follows: ALTER TABLE TableName ENGINE=INNODB;
The table to use
Copy Code code as follows:
CREATE TABLE IF not EXISTS ' test ' (
' ID ' int (a) not NULL auto_increment,
' Websitename ' varchar character set UTF8 not NULL,
' Websiteurl ' varchar character set UTF8 not NULL,
PRIMARY KEY (' id ')
) Engine=innodb DEFAULT Charset=utf8 auto_increment=1;
The second thing is if you add things:
Copy Code code as follows:
<?php
$con = mysql_connect ("localhost", "root", "Vertrigo");
Start a transaction
Mysql_db_query ("Mysqlnew", "BEGIN");
$INSERTSQL = "INSERT INTO Test (Websitename,websiteurl) VALUES (' cloud-dwelling community ', ' http://www.jb51.net ')";//The record is inserted into the database
Mysql_db_query ("Mysqlnew", $INSERTSQL);
$INSERTSQL = "INSERT INTO Test (Websitename,websiteurl) VALUES (' Baidu ', ' http://www.baidu.com ')";//The record is inserted into the database
Mysql_db_query ("Mysqlnew", $INSERTSQL);
Ending transaction transactions
Mysql_db_query ("Mysqlnew", "COMMIT");
Start a transaction
Mysql_db_query ("Mysqlnew", "BEGIN");
$INSERTSQL = "INSERT INTO Test (Websitename,websiteurl) VALUES (' Google ', ' http://www.google.com.hk ')";//The record is not inserted into the database
Mysql_db_query ("Mysqlnew", $INSERTSQL);
Ending transaction transactions
Mysql_db_query ("Mysqlnew", "ROLLBACK");
Start a transaction
Mysql_db_query ("Mysqlnew", "BEGIN");
$INSERTSQL = "INSERT INTO Test (Websitename,websiteurl) VALUES (' Bing ', ' http://www.bing.com ')";//The record is not inserted into the database
Mysql_db_query ("Mysqlnew", $INSERTSQL);
?>
Inserted data
ID Websitename websiteurl
1 cloud-dwelling community http://www.jb51.net
200 degrees Http://www.baidu.com