龙盟编程博客 | 无障碍搜索 | 云盘搜索神器
快速搜索
主页 > web编程 > php编程 >

php innodb 2 myisam php

时间:2015-03-18 15:25来源:网络整理 作者:网络 点击:
分享到:
innodb 2 myisam php lt;?php// display error is On for us to be notified if there#39;s somethingwrongini_set (#39;display_errors#39;,#39;On#39;);error_reporting ( E_ALL );// Config,change this variables$dbServer =quot;localhostquot;;$dbUser =

<?php// display error is On for us to be notified if there's something wrongini_set ('display_errors','On');error_reporting ( E_ALL );// Config, change this variables$dbServer ="localhost";$dbUser ="帐号";$dbPass ="密码";$dbName = $_GET['dbName'];// Set a connection for our database$link = mysql_connect ( $dbServer, $dbUser, $dbPass ) ordie("unable to connect to msql server: ". mysql_error () );// Select our databasemysql_select_db ( $dbName, $link ) ordie("unable to select database 'db': ". mysql_error () );$result = mysql_query ("show tables");if(! $result) {die('query failed: ');}// Use while loop to convert all tables to MyISAMwhile($row = mysql_fetch_array ( $result )) {// Command Reference: ALTER TABLE tableName ENGINE=MyISAMecho"ALTER TABLE ". $row [0] ." ENGINE=MyISAM; ".'<br/>';mysql_query ("ALTER TABLE ". $row [0] ." ENGINE=MyISAM; ");}?>调用页面<?php// display error is On for us to be notified if there's something wrongini_set ('display_errors','On');error_reporting ( E_ALL );// Config, change this variables$dbServer ="localhost";$dbUser ="帐号";$dbPass ="密码";// Set a connection for our database$link = mysql_connect ( $dbServer, $dbUser, $dbPass ) ordie("unable to connect to msql server: ". mysql_error () );$result = mysql_query ("show databases;");if(! $result) {die('query failed: ');}// Use while loop to convert all tables to MyISAMwhile($row = mysql_fetch_array ( $result )) {echo'<a href="innodb2myisam.php?dbName='.$row[0].'">'.$row[0].'<a/><br/>';}?>

[PHP]代码

<?php
// display error is On for us to be notified if there's something wrong
ini_set ( 'display_errors', 'On' );
error_reporting ( E_ALL );
// Config, change this variables
$dbServer = "localhost";
$dbUser = "帐号";
$dbPass = "密码";
$dbName = $_GET['dbName'];
// Set a connection for our database
$link = mysql_connect ( $dbServer, $dbUser, $dbPass ) or die ( "unable to connect to msql server: " . mysql_error () );
// Select our database
mysql_select_db ( $dbName, $link ) or die ( "unable to select database 'db': " . mysql_error () );
$result = mysql_query ( "show tables" );
if (! $result) {
die ( 'query failed: ' );
}
// Use while loop to convert all tables to MyISAM
while ( $row = mysql_fetch_array ( $result ) ) {
// Command Reference: ALTER TABLE tableName ENGINE=MyISAM
echo "ALTER TABLE " . $row [0] . " ENGINE=MyISAM; ".'<br/>';
mysql_query ( "ALTER TABLE " . $row [0] . " ENGINE=MyISAM; " );
}
?>

调用页面

<?php
// display error is On for us to be notified if there's something wrong
ini_set ( 'display_errors', 'On' );
error_reporting ( E_ALL );
// Config, change this variables
$dbServer = "localhost";
$dbUser = "帐号";
$dbPass = "密码";
// Set a connection for our database
$link = mysql_connect ( $dbServer, $dbUser, $dbPass ) or die ( "unable to connect to msql server: " . mysql_error () );
$result = mysql_query ( "show databases;" );
if (! $result) {
die ( 'query failed: ' );
}
// Use while loop to convert all tables to MyISAM
while ( $row = mysql_fetch_array ( $result ) ) {
echo '<a href="innodb2myisam.php?dbName='.$row[0].'">'.$row[0].'<a/><br/>';
}
?>

精彩图集

赞助商链接