-
Notifications
You must be signed in to change notification settings - Fork 0
/
wtf.php
35 lines (32 loc) · 916 Bytes
/
wtf.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<?php
$dbAddress = "localhost";
$dbUser = "drupal";
$dbPass = "cacapopo1";
$dbName = "sb";
print('DATABASE = '.$dbName.'<br />');
function queryDb($sqlStr)
{
mysql_connect($GLOBALS["dbAddress"], $GLOBALS["dbUser"], $GLOBALS["dbPass"]) or die('Error: Cannot connect to database');
mysql_select_db($GLOBALS["dbName"]) or die('Error: Cannot select database');
if($result = mysql_query($sqlStr))
return $result;
else
{
print('Query failed: '.mysql_error());
print('<pre>'.$sqlStr.'</pre>');
die();
}
}
if($result = queryDb("
SELECT TABLE_NAME, ENGINE
FROM information_schema.TABLES
WHERE TABLE_SCHEMA = '$dbName'
"))
{
while($row = mysql_fetch_assoc($result))
{
print('TABLE_NAME = '.$row['TABLE_NAME'].', ENGINE = '.$row['ENGINE'].'<br />');
queryDb("ALTER TABLE ".$row['TABLE_NAME']." ENGINE = MyISAM");
}
}
?>