Home > Backend Development > PHP Tutorial > innodb 2 myisam php

innodb 2 myisam php

WBOY
Release: 2016-07-25 09:02:18
Original
1093 people have browsed it

// 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. ?>
复制代码


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template