首頁 > 後端開發 > php教程 > innodb 2 myisam php

innodb 2 myisam php

WBOY
發布: 2016-07-25 09:02:18
原創
1097 人瀏覽過

// 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; ".'
';

mysql_query ( "ALTER TABLE " . $row [0] . " ENGINE=MyISAM; " );

}

?>

调用页面

// 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 '.$row[0].'">'.$row[0].'
';

}

?>



  1. // display error is On for us to be notified if there's something wrong
  2. ini_set ( 'display_errors', 'On' );
  3. error_reporting ( E_ALL );
  4. // Config, change this variables
  5. $dbServer = "localhost";
  6. $dbUser = "帐号";
  7. $dbPass = "密码";
  8. $dbName = $_GET['dbName'];
  9. // Set a connection for our database
  10. $link = mysql_connect ( $dbServer, $dbUser, $dbPass ) or die ( "unable to connect to msql server: " . mysql_error () );
  11. // Select our database
  12. mysql_select_db ( $dbName, $link ) or die ( "unable to select database 'db': " . mysql_error () );
  13. $result = mysql_query ( "show tables" );
  14. if (! $result) {
  15. die ( 'query failed: ' );
  16. }
  17. // Use while loop to convert all tables to MyISAM
  18. while ( $row = mysql_fetch_array ( $result ) ) {
  19. // Command Reference: ALTER TABLE tableName ENGINE=MyISAM
  20. echo "ALTER TABLE " . $row [0] . " ENGINE=MyISAM; ".'
    ';
  21. mysql_query ( "ALTER TABLE " . $row [0] . " ENGINE=MyISAM; " );
  22. }
  23. ?>
  24. 调用页面
  25. // display error is On for us to be notified if there's something wrong
  26. ini_set ( 'display_errors', 'On' );
  27. error_reporting ( E_ALL );
  28. // Config, change this variables
  29. $dbServer = "localhost";
  30. $dbUser = "帐号";
  31. $dbPass = "密码";
  32. // Set a connection for our database
  33. $link = mysql_connect ( $dbServer, $dbUser, $dbPass ) or die ( "unable to connect to msql server: " . mysql_error () );
  34. $result = mysql_query ( "show databases;" );
  35. if (! $result) {
  36. die ( 'query failed: ' );
  37. }
  38. // Use while loop to convert all tables to MyISAM
  39. while ( $row = mysql_fetch_array ( $result ) ) {
  40. echo ''.$row[0].'
    ';
  41. }
  42. ?>
复制代码


相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板